BrettSheleski / SmartThingsPublic

36 stars 23 forks source link

Add support for power metering and switch updates #36

Open deiger opened 4 years ago

deiger commented 4 years ago

Add tiles and capabilities similar to e.g. "Zigbee Metering Plug", for Power Meter and Energy Meter. Also made it auto-refresh every minute - this is applicable also for non power metering switches, as at the moment a manual switch would go unnoticed.

BrettSheleski commented 4 years ago

Thanks for the contribution, however I believe you put the energy monitoring stuff in the wrong device handler. The Tasmota-Power device handler is meant to be a child device for devices like the Sonoff Basic which had no energy monitoring capabilities. This is why the momentary capability (that I saw you removed) was also declared.

Instead a different device handler should be used/created (can't remember if there's the start of one or not already).

BrettSheleski commented 4 years ago

Please create a "Tasmota-Energy" device handler that handles the reporting of energy monitoring stuff. Then update the main Tasmota device handler to spawn this new child device handler for the correct module type(s).

This way if your device does not support energy monitoring then you will not have the every monitoring device spawned by SmartThings.

deiger commented 4 years ago

OK, moved to a new device handler. PTAL. Note that some devices templates here use Generic (18), so they won't get the right child device now.

BrettSheleski commented 4 years ago

The Sonoff-POW should spawn both a Tasmota-Power and a Tasmota-Energy child device. The two handlers should do their things independently.

Please remove the Switch capability from the Tasmota-Energy (that's what the Tasmota-Power device handler is for).

deiger commented 4 years ago

I'm not sure I understand why. It's a single device, with a single functionality. The energy metering is coupled with the switch. I for one would find it unusable if I had two separate devices for it. This is how this is done e.g. for Zigbee switches like "Zigbee Metering Plug", as well as for Z-Wave modules like Qubino and Fibaro. For the latter, in case of a double relay you get a child device for each, but the power metering is added on the existing devices. I can fully understand that an unrelated sensor that "rides" on a relay (like Sonoff TH10 or Qubino's temperature sensor) would get it's own device, but in this case the metering is for that specific device.