Shelly Device Handlers for Hubitat

All sorted. Issue with my network name. Thanks

1 Like

@Evilborg

Can you help me make sense of the energy reporting? From the app, I see 2.7 kWh of usage for a Shelly 1PM for today.

Looking at the JSON from the "/status" page, I see:

"meters":[{"power":389.58,"overpower":0.00,"is_valid":true,"timestamp":1673805603,"counters":[388.931, 388.849, 152.441],"total":237693}]

So, two fold:

  1. Is reporting the total as watts in the driver correct? I think watts would be (power_total / 100) and to get kWh (for use in calculating energy costs would be (power_total/100000).

  2. If I take 2702.23 (app CSV download total from below) and subtract 2376.93 (power "total" reported by the device), I get ~325.3 wh difference. Any ideas on the disparity?


I dont understand it either. This is something you need to ask the Shelly people directly.

Thanks for the quick reply. Not gonna lie, I completely glazed over the first post :laughing:. I shot them a message on the Books of Faces.

1 Like

According to this: API Reference

power is instantaneous active power in watts. If you want it in kW, divide by 1000. Keep in mind that this is not real power if you are driving a reactive load.

total is total energy used since last reboot, in watt-minutes. If you want it in kWh, divide by 60,000.

They must be doing some accumulation per day and calculating the daily energy based on that. You could do that by adding up power usage throughout the day and multiplying times the elapsed time. Or just rebooting the Shelly at precisely midnight. :wink:

EDIT: I would guess they are using the energy timestamp and last 3 minutes values to keep a running total of energy usage. I don't see anything in their API that reports a running total for the day directly.

1 Like

That's it and the link helps a ton. Probably should've thought to check it earlier (there's a daggum link inside the driver page).

This is all for getting it to work with my energy cost app where I'm expecting a kWh value. I'm doing similar to what I presume they are. I'm setting the energy value at the start of the day to a variable and using that as a reference point to get energy use for today. I'm also storing the last value to compare to the current value to get the change amount between readings for calculating cost (to account for differing costs throughout the day). I have some logic in there to account for a reset.

1 Like

I think your scaling to get to kWh from total is wrong, but it was maybe coincidentally close enough to what the other app told you for the day that it was confusing.

What was your total value at the beginning of the day timestamp? What is the total number now? If you subtract those and divide by 60,000 (instead of 100,000), do the two apps match?

In your example, 237693 (watt-minutes) / 60000 = 3.96 kWh. What was your value at the beginning of the day in that example?

All good. I straightened out the scaling based on your last reply and confirmed it was accurate. Think it was just coincidental that the rabbit hole I ran down before was close.

1 Like

So I tried to cut some corners in changing a device over to a shelly... But I've come unstuck. Then deleted the device and tried to add one again.

Now getting the error shown below. How do I fix this? It's not as simple as changing the device value in the device page is it? The child devices aren't being populated.

Seems changing the fixed IP address and rebooting the Shelly fixed this... Or coincidence?

So I added another Shelly wifi switch.. but this one won't update the status unless I go to refresh on the device page. Why would this particular device not update its status unless I click refresh? The others work fine.

I have checked the "output on" and output off and they both have the http://hubitathubaddress:39501/switch/0/on or off in them.. So I'm unsure why the status of the device in hubitat doesn't change when I turn the device in Shelly app.. but it works for the other wifi switches without needing to refresh them.

Bigger Problem is if I click to turn the switch on in a hubitat dashboard then the the status of that switch in the dashboard stays as greyed out with the hour glass...

Ok so I tried for while... But after posting this I went back into Google home app in hubitat and rechecked that this light was ticked.. not thinking that would make any difference .

Now updates of status seem to work for this device ...

Google home is NOT supported with Shelly drivers here as Google home sucks and no one should be using it.

1 Like

I use Google home a lot, only for speech commands. The moment you make the decision to work with the cloud I think it is better to use the connection Shelly --> google and not via Hubitat.

Same here, only for speech commands. I expose them to google so they are recognised as switches purely for speech. All rules relating to them are run locally. However I hadn't considered adding the Shelly integration into Google home for speech

Whatever it was that made the status update work, without needing to click refresh, it's reliably worked since.

Hello, everyone!

I'd like to extend an invitation for others to join the driver project.

@Evilborg is still going to lead the project, do code review, and contribute, but it's time to allow others to help.

If you're interested, please contact Scott or me to talk about how you see contributing.

I have had 2 strokes in the past year and half and its time for help.. there are perks to this gig too.

4 Likes

Hi All. Newbie here, I'm afraid. I have successfully managed to get my Shelly Plus 2PM working fine, thanks to @Evilborg drivers. What I am struggling with is my Shelly EM. I am using the Shelly Energy Meter driver v 1.0.1 but I have no idea how to successfully put a tile an a dashboard showing how much energy is being used. Any 'pointers' would be very gratefully received. Many thanks

You might want to post that question in the drivers page, not same author...

Thanks for the suggestion @nclark . I have, however, already posted on there but received no response as yet. I suspect it is me doing something amateurish that is causing the problem and I thought also asking on here on what is a busier forum may yield some tips. Happy to remove from this page though if causing offence to anyone?

1 Like