How to separate values in Python Event where the n_value or s_value returns more than 1?
Posted: Wednesday 12 April 2023 7:38
Hi,
I am struggling with the following task.
My electric boiler switches on 1 hour after sunrise so it can benefit the most from my solar panels.
I would like to switch on the charging of my electric car, after the boiler is done.
There is a smart switch on my boiler, which measures the power.
The challenge is, that this switch gives me 2 values
0.000;14030760.000 when not in use and for example
2523.100;14030760.000 when it is heating.
so the value for current usage is before the ; and the total usage behind the ;
What is the correct way to get the value from current usage so I can make a if statement that when current usage is below 1500, the charging of the car can start?
Cuurent try:
import DomoticzEvents as DE
if DE.changed_device_name == "Boiler kWh Meter":
DE.Log("--Python: Changed: " + DE.changed_device.Describe() )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " n_value : " + str(DE.changed_device.n_value) )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " n_value_string : " + str(DE.changed_device.n_value_string) )
# n_value_string gives --Python: device: 12 Boiler kWh Meter n_value_string : 0.000;14028750.000
# which seems to be current usage and total usage. How to get only the current usage?
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " s_value : " + str(DE.changed_device.s_value) )
I am struggling with the following task.
My electric boiler switches on 1 hour after sunrise so it can benefit the most from my solar panels.
I would like to switch on the charging of my electric car, after the boiler is done.
There is a smart switch on my boiler, which measures the power.
The challenge is, that this switch gives me 2 values
0.000;14030760.000 when not in use and for example
2523.100;14030760.000 when it is heating.
so the value for current usage is before the ; and the total usage behind the ;
What is the correct way to get the value from current usage so I can make a if statement that when current usage is below 1500, the charging of the car can start?
Cuurent try:
import DomoticzEvents as DE
if DE.changed_device_name == "Boiler kWh Meter":
DE.Log("--Python: Changed: " + DE.changed_device.Describe() )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " n_value : " + str(DE.changed_device.n_value) )
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " n_value_string : " + str(DE.changed_device.n_value_string) )
# n_value_string gives --Python: device: 12 Boiler kWh Meter n_value_string : 0.000;14028750.000
# which seems to be current usage and total usage. How to get only the current usage?
DE.Log("--Python: device: " + str(DE.changed_device.id) + " " + str(DE.changed_device.name) + " s_value : " + str(DE.changed_device.s_value) )