Code: Select all
import DomoticzEvents as DEVS
DEVS.Log("Python: Changed: " + DEVS.changed_device.Describe())
DEVS.Log("DEVS.changed_device_name: " + str(DEVS.changed_device_name))
DEVS.Log("DEVS.changed_device.name: " + "ID: " + str(DEVS.changed_device.id) + " Name: " + str(DEVS.changed_device.name))
DEVS.Log("Python: Number of user_variables: " + str(len(DEVS.user_variables)))
# All user_variables are treated as strings, convert as necessary
for key, value in DEVS.user_variables.items():
DEVS.Log("Python: User-variable '{0}' has value: {1}".format(key, value))
DEVS.Log("DIR(dir(DEVS.changed_device)): " + str(dir(DEVS.changed_device)))
DEVS.Log("DIR(DEVS): " + str(dir(DEVS)))
for device in DEVS.Devices:
if device:
DEVS.Log("device: " + str(device) + " Id: " + str(DEVS.Devices[device].id) + " n_value_string: " + str(
DEVS.Devices[device].n_value_string) + " s_value: " + str(
DEVS.Devices[device].s_value) + " Last updated: " +
str(DEVS.Devices[device].last_update_string) + " All typs:" + str(
DEVS.Devices[device].sub_type) + " " + str(DEVS.Devices[device].switch_type) + " " + str(
DEVS.Devices[device].type))
Output is:
Code: Select all
2019-03-04 15:41:00.448 DEVS.changed_device_name:
2019-03-04 15:41:00.449 DEVS.changed_device.name: ID: 0 Name:
2019-03-04 15:41:00.450 Python: Number of user_variables: 0
2019-03-04 15:41:00.452 DIR(dir(DEVS.changed_device)): ['Describe', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'id', 'last_update_string', 'n_value', 'n_value_string', 'name', 's_value', 'sub_type', 'switch_type', 'type']
2019-03-04 15:41:00.454 DIR(DEVS): ['Command', 'Devices', 'Log', '__doc__', '__loader__', '__name__', '__package__', '__spec__', 'changed_device', 'changed_device_name', 'is_daytime', 'is_nighttime', 'minutes_since_midnight', 'sunrise_in_minutes', 'sunset_in_minutes', 'user_variables']
2019-03-04 15:41:00.455 device: CPU_Usage Id: 1 n_value_string: 0.39 s_value: 0.39 Last updated: 2019-03-04 15:40:34 All typs:6 0 243
2019-03-04 15:41:00.456 device: Memory Usage Id: 2 n_value_string: 18.75 s_value: 18.75 Last updated: 2019-03-04 15:40:24 All typs:6 0 243
2019-03-04 15:41:00.457 device: Process Usage Id: 3 n_value_string: 13.9000 s_value: 13.9000 Last updated: 2019-03-04 15:40:24 All typs:31 0 243
2019-03-04 15:41:00.458 device: HDD /overlay Id: 5 n_value_string: 16.36 s_value: 16.36 Last updated: 2019-03-04 15:40:44 All typs:6 0 243