Beispiel #1
0
                        help="Battery type(1=Sealed,2=Gel,3=Flooded)",
                        type=int,
                        dest="battery_type",
                        default=None)
    parser.add_argument("-c",
                        "--battery-capacity",
                        help="Battery capacity in Ah",
                        type=int,
                        dest="battery_capacity",
                        default=None)
    args = parser.parse_args()

    client = EPsolarTracerClient(port="/dev/ttyXRUSB0")

    if args.battery_type is None:
        print "Battery type: %s" % (
            battery_types[client.read_input(REG_BATTERY_TYPE).value])
    else:
        if args.battery_type in (1, 2, 3):
            client.write_output(REG_BATTERY_TYPE, args.battery_type)
            print "Battery type set to %s" % (battery_types[args.battery_type])
        else:
            print "Invalid battery type"

    if args.battery_capacity is None:
        print "Battery capacity: %dAh" % (
            client.read_input(REG_BATTERY_CAPACITY).value)
    else:
        client.write_output(REG_BATTERY_CAPACITY, args.battery_capacity)
        print "Battery capacity set to %dAh" % (args.battery_capacity)
    # 0000H Manual Control
    # 0001H Light ON/OFF
    # 0002H Light ON+ Timer/
    # 0003H Time Control
    loadCtrlMode = 0x0003

    #response = client.client.write_registers(loadCtrlModesAddr, loadCtrlMode, unit = client.unit)
    #print "Write result: " + str(vars(response))

    response = client.read_input("Load controling modes")
    print "Load controlling mode: " + hex(response.value)

    #response = client.write_output("Turn on timing 1 hour",9)
    #response = client.write_output("Turn on timing 1 min",30)
    response = client.write_output("Turn off timing 1 hour", 16)
    response = client.write_output("Turn off timing 1 min", 0)
    #response = client.write_output("Turn on timing 2 hour",9)
    #response = client.write_output("Turn on timing 2 min",30)
    response = client.write_output("Turn off timing 2 hour", 16)
    response = client.write_output("Turn off timing 2 min", 0)

    print "Load Time Contolled #1"
    second = client.read_input("Turn on timing 1 sec").value
    minute = client.read_input("Turn on timing 1 min").value
    hour = client.read_input("Turn on timing 1 hour").value
    print "  ON:  %02d:%02d:%02d" % (int(hour), int(minute), int(second))
    second = client.read_input("Turn off timing 1 sec").value
    minute = client.read_input("Turn off timing 1 min").value
    hour = client.read_input("Turn off timing 1 hour").value
    print "  OFF: %02d:%02d:%02d" % (int(hour), int(minute), int(second))
Beispiel #3
0
from pyepsolartracer.client import EPsolarTracerClient
from pyepsolartracer.registers import registers, coils
from pymodbus.client.sync import ModbusSerialClient as ModbusClient

# configure the client logging
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)

serialclient = ModbusClient(method='rtu',
                            port='/dev/ttyXRUSB0',
                            baudrate=115200,
                            stopbits=1,
                            bytesize=8,
                            timeout=0.05)

client = EPsolarTracerClient(serialclient=serialclient)
client.connect()

print client.write_output("Manual control the load", True)
value = client.read_input("Manual control the load")
print value

client.close()
Beispiel #4
0
log.setLevel(logging.INFO)

# choose the serial client
serialclient = ModbusClient(method='rtu',
                            port='/dev/ttyXRUSB0',
                            baudrate=115200,
                            stopbits=1,
                            bytesize=8,
                            timeout=1)
#serialclient = None

# choose the serial client
client = EPsolarTracerClient(serialclient=serialclient)
client.connect()

client.write_output("Battery Capacity", 408)
# 400 if parellelized
client.write_output("Battery Type", 0x0000)
# = custom
client.close()

client.connect()
#client.write_output("High Volt.disconnect", 15.0)
client.write_output("Charging limit voltage", 14.6)
client.write_output("Over voltage reconnect", 14.8)
client.write_output("Equalization voltage", 14.6)  # not required with agm
client.write_output("Boost voltage", 13.8)
client.write_output("Float voltage", 13.4)

client.write_output("Boost reconnect voltage", 13.2)
client.write_output("Low voltage reconnect", 12.2)
Beispiel #5
0
                            timeout=1)
#serialclient = None

client = EPsolarTracerClient(serialclient=serialclient)
client.connect()

response = client.read_device_info()
#print "Manufacturer:", repr(response.information[0])
#print "Model:", repr(response.information[1])
#print "Version:", repr(response.information[2])

#response = client.read_input("Charging equipment rated input voltage")
#print str(response)

vlist = []

for reg in Jregisters:
    #print
    print reg.address
    value = client.read_input(reg.name)
    vlist.append(value)
    #print value
    if reg.address == 36885:
        X = value.value + 1
        print reg.name
        print client.write_output(reg.name, X)

print ",".join(map(str, vlist))

client.close()