Skip to content

Commit 8e41ea9

Browse files
authored
Update developer_guide.md
1 parent aabe151 commit 8e41ea9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

docs/developer_guide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ The meaning of the parameters of a button autorepeat value_function is:
108108
* datadict: the dictionary with all the known entity values
109109

110110
In its current form, the function should return a dictionary containing following items:
111-
* action: the modbus type of write to be executed: currently only MODBUS_WRITE_MULTI is suppored, but the other writes can be easily added later.
112-
* register (optional): if not specified, the register address for the autorepeat button will be used
113-
* data: a list of tuples `[ (entity_key, value,), ....]` that represents the payload of a write_multiple command that starts at the modbus register addres. Instead of the entity_key_name, a register type can also be specified like `REGISTER_U16`. The payload should not contain the button's entity itself, just the data that needs to be added in the write_multiple scenario.
114111

115-
In the future, the return value may be extended to allow other types of writes (to different addresses).
116-
The system will automatically compute the length of the write_multiple payload to be executed.
112+
- `action`: the modbus type of write to be executed: currently only MODBUS_WRITE_MULTI is suppored, but the other writes can be easily added later.
113+
- `register` (optional): if not specified, the register address for the autorepeat button will be used
114+
- `data`: a list of tuples `[ (entity_key, value,), ....]` that represents the payload of a write_multiple command that starts at the modbus register addres. Instead of the entity_key_name, a register type can also be specified like `REGISTER_U16`. The payload should not contain the button's entity itself, just the data that needs to be added in the write_multiple scenario. In the future, the `data` structure may be modified to allow other types of writes.
115+
116+
The system will automatically convert the data to the modbus low level format, and compute the length of the write_multiple payload to be written to modbus.
117117

118118
The autorepeat value_function is called once for every polling loop, so it is up to the value function to reduce the number of interactions if desired. Currently, the value_function cannot pass data to the next polling cycle's `value_function`'s call. This could be enhanced as using global variables is not considered a best practice (may fail in case of multiple inverters/hubs). Storing this data in the descr._hub object may be better, but it is still not very transparent. Storing data in the `datadict` dictionary may work in future versions, please use a name that cannot conflict with other entities.
119119
____

0 commit comments

Comments
 (0)