Ejemplo n.º 1
0
def main():
    client = ModbusClient(host=host_ip, port=host_port, timeout=2)
    client.connect()

    unit = pyse.StiebelEltronAPI(client, slave)
    unit.update()

    execute_tests(unit)

    client.close()
    def pyse_api(self, request, pymb_s):
        # parameter pymb_s leads to call of fixture
        mb_c = ModbusClient(host=host_ip, port=host_port, timeout=2)
        api = pyse.StiebelEltronAPI(mb_c, slave, update_on_read=True)

        # Cleanup after last test (will run as well, if setup fails).
        def fin():
            mb_c.close()
            time.sleep(0.5)

        request.addfinalizer(fin)

        # Connect Modbus client
        connected = mb_c.connect()
        assert connected

        # Read values from device (server)
        success = api.update()
        assert success

        return api
Ejemplo n.º 3
0
    def __init__(self, name, modbus_client):
        """Init the STIEBEL ELTRON data object."""

        self.api = pystiebeleltron.StiebelEltronAPI(modbus_client, 1)