I have a question about adding creating a plugin with the plugin framework. My goal is to combine a number of values of measurements in a domoticz device.
Create devices example:
Code: Select all
if 1 not in Devices:
Domoticz.Device(Name="Voltage L1,L2,L3", Unit=1,TypeName="Voltage",Used=0).Create()
if 2 not in Devices:
Domoticz.Device(Name="Current L1,L2,L3", Unit=2,TypeName="Current/Ampere",Used=0).Create()
Code: Select all
Devices[1].Update(0,str(230.1)+";"+str(230.2)+";"+str(230.3))
Devices[2].Update(0,str(10.1)+";"+str(10.2)+";"+str(10.3))
What I just don't understand is why this doesn't work for voltages and it does for currents. I made the assumption that with this constuction you could build any available device with measurements of the same type. Below a number of merged images where you can see what I mean. I have also added the log file for clarification.
Can someone help me to combine measurements of the same type in a domoticz device?
Click image to view full-size:
Logging
Code: Select all
sudo service domoticz restart && sudo tail -f /var/log/domoticz.log
2019-05-01 21:19:12.400 (test) onStop called
2019-05-01 21:19:12.466 Status: (test) Stopping threads.
2019-05-01 21:19:12.648 Status: (test) Exiting work loop.
2019-05-01 21:19:12.648 Status: (test) Stopped.
2019-05-01 21:19:12.655 Status: Scheduler stopped...
2019-05-01 21:19:12.729 Status: EventSystem: Stopped...
2019-05-01 21:19:12.737 Status: EventSystem - Python stopped...
2019-05-01 21:19:13.164 Status: PluginSystem: Exiting work loop.
2019-05-01 21:19:13.171 Status: PluginSystem: Stopped.
2019-05-01 21:19:13.229 Status: Mainworker Stopped...
2019-05-01 21:19:13.381 Status: RxQueue: queue worker started...
2019-05-01 21:19:15.406 Status: (test) Started.
2019-05-01 21:19:15.407 Status: EventSystem: reset all events...
2019-05-01 21:19:15.407 Status: EventSystem: reset all device statuses...
2019-05-01 21:19:15.452 Status: Python EventSystem: Initalizing event module.
2019-05-01 21:19:15.452 Status: EventSystem: Started
2019-05-01 21:19:15.452 Status: EventSystem: Queue thread started...
2019-05-01 21:19:15.827 Status: PluginSystem: Entering work loop.
2019-05-01 21:19:15.868 Status: (test) Initialized version 1.0.0, author 'meuk'
2019-05-01 21:19:15.868 Status: (test) Entering work loop.
2019-05-01 21:19:15.869 (test) onStart called
2019-05-01 21:19:15.869 (test) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
2019-05-01 21:19:15.869 (test) 'Version':'1.0.0'
2019-05-01 21:19:15.869 (test) 'Port':'0'
2019-05-01 21:19:15.869 (test) 'DomoticzHash':'b47a877f'
2019-05-01 21:19:15.869 (test) 'DomoticzBuildTime':'2018-06-23 16:27:56'
2019-05-01 21:19:15.869 (test) 'HardwareID':'7'
2019-05-01 21:19:15.869 (test) 'Key':'TestPlug'
2019-05-01 21:19:15.869 (test) 'Author':'meuk'
2019-05-01 21:19:15.869 (test) 'DomoticzVersion':'4.9701'
2019-05-01 21:19:15.869 (test) 'HomeFolder':'/home/meuk/domoticz/plugins/testing/'
2019-05-01 21:19:15.869 (test) 'Name':'test'
2019-05-01 21:19:15.869 (test) Device count: 2
2019-05-01 21:19:15.869 (test) Device: 1 - ID: 13, Name: 'test - Voltage L1,L2,L3', nValue: 0, sValue: '230.1;230.2;230.3'
2019-05-01 21:19:15.869 (test) Device ID: '13'
2019-05-01 21:19:15.869 (test) Device Name: 'test - Voltage L1,L2,L3'
2019-05-01 21:19:15.869 (test) Device nValue: 0
2019-05-01 21:19:15.869 (test) Device sValue: '230.1;230.2;230.3'
2019-05-01 21:19:15.869 (test) Device LastLevel: 0
2019-05-01 21:19:15.870 (test) Device: 2 - ID: 14, Name: 'test - Current L1,L2,L3', nValue: 0, sValue: '10.1;10.2;10.3'
2019-05-01 21:19:15.870 (test) Device ID: '14'
2019-05-01 21:19:15.870 (test) Device Name: 'test - Current L1,L2,L3'
2019-05-01 21:19:15.870 (test) Device nValue: 0
2019-05-01 21:19:15.870 (test) Device sValue: '10.1;10.2;10.3'
2019-05-01 21:19:15.870 (test) Device LastLevel: 0
2019-05-01 21:19:15.870 (test) createDevices
2019-05-01 21:19:25.370 (test) Pushing 'onHeartbeatCallback' on to queue
2019-05-01 21:19:25.391 (test) Processing 'onHeartbeatCallback' message
2019-05-01 21:19:25.391 (test) Calling message handler 'onHeartbeat'.
2019-05-01 21:19:25.391 (test) onHeartbeat called
2019-05-01 21:19:25.391 (test) updateDevices
2019-05-01 21:19:25.392 (test - Voltage L1,L2,L3) Updating device from 0:'230.1;230.2;230.3' to have values 0:'230.1;230.2;230.3'.
2019-05-01 21:19:25.393 (test - Current L1,L2,L3) Updating device from 0:'10.1;10.2;10.3' to have values 0:'10.1;10.2;10.3'.
2019-05-01 21:19:35.372 (test) Pushing 'onHeartbeatCallback' on to queue
2019-05-01 21:19:35.416 (test) Processing 'onHeartbeatCallback' message
2019-05-01 21:19:35.416 (test) Calling message handler 'onHeartbeat'.
2019-05-01 21:19:35.416 (test) onHeartbeat called
2019-05-01 21:19:35.416 (test) updateDevices
2019-05-01 21:19:35.416 (test - Voltage L1,L2,L3) Updating device from 0:'230.1;230.2;230.3' to have values 0:'230.1;230.2;230.3'.
2019-05-01 21:19:35.417 (test - Current L1,L2,L3) Updating device from 0:'10.1;10.2;10.3' to have values 0:'10.1;10.2;10.3'.