Skip to content

devolo Metering Plug

Guido Schmitz edited this page Apr 19, 2020 · 4 revisions

The following snippets assume, that you already created a working instance of HomeControl and an instance of Mydevolo. Please see the page about connecting to the backend for further information.

Get state of a metering plug

First you need to find the device UID of the metering plug you want to switch - in this snippet called "Light". Then you need to find the property "binary_switch". Since the devolo Metering Plugs only have one switch, you can directly access the first list object and access the state.

metering_plug = homecontrol.devices.get(homecontrol.device_names.get("Light"))
binary_switch = metering_plug.get_property("binary_switch")[0]
print(binary_switch.state)

Turning on/off a metering plug

Let's assume you want to switch the same metering plug as in the last chapter. So finding it needs basically the same steps. You can set the binary switch to either True (turn on) or False (turn off).

metering_plug = homecontrol.devices.get(homecontrol.device_names.get("Light"))
binary_switch = metering_plug.get_property("binary_switch")[0]
binary_switch.set_binary_switch(state=True)

Get power consumption

Let's assume once again you want to switch the same metering plug as in the last chapter. This time you need to find the property "consumption". Since the devolo Metering Plugs only have one measuring system, you can directly access the first list object. It will show you the current power consumption including its unit, the total consumption including its unit and the date, this collection was started.

metering_plug = homecontrol.devices.get(homecontrol.device_names.get("Light"))
consumption = metering_plug.get_property("consumption")[0]
print(consumption.current)
print(consumption.current_unit)
print(consumption.total)
print(consumption.total_unit)
print(consumption.total_since)
Clone this wiki locally