Hello,
i need help using the updating server example because I don't know how to continue.
I tried to find the information in the web and other discussions, but I didn't.
Scope of work:
I get a value via MQTT (using paho mqtt) and write this value every second in a register
Example FC: 03
Value via MQTT: 10000
target register: 40001
So far so good.
Is it correct, that the section def run_updating_server(): just initializes the registers and after first initialization the def updating_writer(a): is doing the update job ?
def updating_writer(a):
""" A worker process that runs every so often and
updates live values of the context. It should be noted
that there is a race condition for the update.
:param arguments: The input arguments to the call
"""
log.debug("updating the context")
context = a[0] ==> Don't know what this does
register = 3 ==> FC 03
slave_id = 0x01 ==> ID of slave to find within the network (Here: 1)
address = 0x9C41 ==> register adress (Here: 40001)
values = context[slave_id].getValues(register, address, count=5) => shouldn't here the new value be ?
values = [v + 1 for v in values] => ?
log.debug("new values: " + str(values))
context[slave_id].setValues(register, address, values)
Thank you very much.
Alex