ha-wyzeapi
ha-wyzeapi copied to clipboard
[Feature Request] Energy Monitoring for Smart Plugs
The Wyze smart plugs offer basic energy monitoring. Is it possible to expose this to HA? I hadn't seen anything on it yet, so I figured I would pop in an issue. Forgive me if this has already been addressed.
My v1 plugs do not unfortunately... I would need to have new ones to start working on that
If I remember correctly, I believe I have an extra one still in the box at home. I would be more than happy to donate it to the cause. I'll double check as soon as I get off work and let you know.
-- Jason Adams
On Thu, Aug 12, 2021 at 1:03 PM Joshua Mulliken @.***> wrote:
My v1 plugs do not unfortunately... I would need to have new ones to start working on that
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-897808837, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLBCBSYLQXJ4XDYQG3DT4P5GPANCNFSM5CBV24XA .
@lordlala I might be able to try and do the data collection on the plug if you want to share it with my testing account. I think I may need to be online to accept it though (that seems to be the case with what I've shared between them so far). This might be a better situation that providing a device ok to someone else. Unfortunately, not all of the data is the same for an account that it's been shared with.
Yeah, absolutely let's do it. In fact, I still have one new in the box, so I'll hook that up and get it setup. Just let me know in a regular reply where you'd want me to share it (email or whatever wyze likes).
-- Jason Adams
On Thu, Sep 16, 2021 at 5:24 PM Joe Schubert @.***> wrote:
@lordlala https://github.com/lordlala I might be able to try and do the data collection on the plug if you want to share it with my testing account. I think I may need to be online to accept it though (that seems to be the case with what I've shared between them so far). This might be a better situation that providing a device ok to someone else. Unfortunately, not all of the data is the same for an account that it's been shared with.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-921259827, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLF2R6SKA36WK3CK4UTUCJOCBANCNFSM5CBV24XA .
Sounds good, if you want to share it to [email protected] I can see what data it gives me as a shared device.
Like I said, it may not work... I know that the lock for instance restricts what the shared person can get to in it. But I'm happy to try.
I can always set up a brand new account just for this plug and you can have admin access to it if it helps you figure all this out :)
I even have a segregated WiFi too, so it will work out nicely.
I'll let you know when I can get it setup, then I'll send you credentials. Hopefully tonight.
-- Jason Adams
On Fri, Sep 17, 2021 at 1:20 PM Joe Schubert @.***> wrote:
Sounds good, if you want to share it to @.*** I can see what data it gives me as a shared device.
Like I said, it may not work... I know that the lock for instance restricts what the shared person can get to in it. But I'm happy to try.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-921957750, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLCS5V2U4M544BXTTYTUCN2ERANCNFSM5CBV24XA .
Hey there!
So I went ahead and created a testing gmail account and a testing Wyze account and connected a brand new outdoor plug (wifi) to it. I also set up each plug to draw power at different amounts. One is a battery charger for outdoor equipment and the other is a very low wattage fluorescent lamp.
The gmail account:
@.*** Wyzetester!
and the Wyze account is exactly the same as above.
If you two need me to reset it or unplug it or anything just let me know.
I figured it would be good to let you two have gmail in case you need to contact Wyze or anything like that.
Let me know if you have any questions and how it goes!
You guys can share this out as you wish but if it gets jacked up it's on you LOL.
-- Jason Adams
On Fri, Sep 17, 2021 at 1:20 PM Joe Schubert @.***> wrote:
Sounds good, if you want to share it to @.*** I can see what data it gives me as a shared device.
Like I said, it may not work... I know that the lock for instance restricts what the shared person can get to in it. But I'm happy to try.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-921957750, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLCS5V2U4M544BXTTYTUCN2ERANCNFSM5CBV24XA .
@lordlala so, i tried that info (it was uncensored in my notification). Google can't find the account, nor can wyze. are you sure you typed it out right? If you want, you can always join the IRC server for a few minutes to work this out.
Thanks,
Jason Adams
On Sep 17, 2021, at 6:57 PM, Joe Schubert @.***> wrote:
@lordlala so, i tried that info (it was uncensored in my notification). Google can't find the account, nor can wyze. are you sure you typed it out right? If you want, you can always join the IRC server for a few minutes to work this out.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Let me know if that works for you.
-- Jason Adams
On Fri, Sep 17, 2021 at 7:10 PM Jason Adams @.***> wrote:
Thanks,
Jason Adams
On Sep 17, 2021, at 6:57 PM, Joe Schubert @.***> wrote:
@lordlala https://github.com/lordlala so, i tried that info (it was uncensored in my notification). Google can't find the account, nor can wyze. are you sure you typed it out right? If you want, you can always join the IRC server for a few minutes to work this out.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-922123217, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLECFI5I7UQDBDJ2XYTUCPBVNANCNFSM5CBV24XA .
@lordlala still getting invalid username/password for the wyze app. Tried the email as the login for gmail, still getting unknown email.
If you could, just try to share the device with Yoinx "at" graffiti.net
Super bizarre. I literally just signed in to Wyze using this:
@.*** Wyzepassword1
I also shared it out to you both. Hopefully that works enough.
Thanks,
Jason Adams
On Sep 17, 2021, at 10:51 PM, Joe Schubert @.***> wrote:
If you could, just try to share the device with Yoinx "at" graffiti.net
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@lordlala yeah, I have no idea. I just tried again, with no luck. I did get the share invites for 2 plugs though. I'm able to see the "usage" section for them, but it's showing as 0kwh. I'll try to sniff the API info sometime today.
I am a little curious thoughthough given the way that section looks if it's actually doing energy monitoring. The plugs I have show you "run times" for how long the plugs were on, in a somewhat similar manner.
Well it’s a start!
So the light has usage numbers in the app but the battery charger does not. Wonder if someone at home turned it off. I’ll check later.
On Sat, Sep 18, 2021 at 8:13 AM Joe Schubert @.***> wrote:
@lordlala https://github.com/lordlala yeah, I have no idea. I just tried again, with no luck. I did get the share invites for 2 plugs though. I'm able to see the "usage" section for them, but it's showing as 0kwh. I'll try to sniff the API info sometime today.
I am a little curious thoughthough given the way that section looks if it's actually doing energy monitoring. The plugs I have show you "run times" for how long the plugs were on, in a somewhat similar manner.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-922267587, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLG6N6QSHECIRB2RJNTUCR65DANCNFSM5CBV24XA .
-- Thank you,
Jason Adams
@lordlala
so, i got a chance to try and pull the data. unfortunately, the details you provided still don't work for me. On my test account where they're shared, I get an unauthorized error whenever I try to check the usage data (blame wyze's API).
If you could join into https://web.libera.chat/ channel: wyzeapi
just mention me by name so my app notifies me and I can try to get this figured out. I'm wondering if it just shows the same as the original plug's time based usage.
So sorry for the delay.
I would love to chat to get this up and running. When I get off of work, I'll do my best to connect with you.
Joshua, how are you doing? Need me to do anything?
Also, are you guys interested in my code that pulls data from wyze scale?
It's pretty robust, pulls all attributes, then has the capability of pushing those attributes to HA so it can be recorded statistically and historically.
I can upload it to Git if you guys want to take a look at it.
-- Jason Adams
On Sat, Sep 18, 2021 at 6:27 PM Joe Schubert @.***> wrote:
@lordlala https://github.com/lordlala
so, i got a chance to try and pull the data. unfortunately, the details you provided still don't work for me. On my test account where they're shared, I get an unauthorized error whenever I try to check the usage data (blame wyze's API).
If you could join into https://web.libera.chat/ channel: wyzeapi
just mention me by name so my app notifies me and I can try to get this figured out. I'm wondering if it just shows the same as the original plug's time based usage.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-922382469, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLHPHAVRU3LD5IXR753UCUG3JANCNFSM5CBV24XA .
@lordlala Yeah that sounds great! If you can get a PR together I am planning on merging @Yoinx 's code here shortly so we might have a few merge conflicts that will have to be addressed but we can cross that bridge when we get there
Question - any particular reason you use wyzeapy instead of wyze_sdk?
-- Jason Adams
On Tue, Sep 21, 2021 at 10:58 AM Joshua Mulliken @.***> wrote:
@lordlala https://github.com/lordlala Yeah that sounds great! If you can get a PR together I am planning on merging @yoinx https://github.com/yoinx 's code here shortly so we might have a few merge conflicts that will have to be addressed but we can cross that bridge when we get there
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-924071990, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLFOB6T4ZPUP6SO6SOLUDCMRDANCNFSM5CBV24XA .
Bear with me. I actually wrote the code using wyze_sdk without even thinking about it.
I am working now to adapt the code into this code.
Wyze_SDK comes with Scale support out of the box.
-- Jason Adams
On Tue, Sep 21, 2021 at 6:34 AM Jason Adams @.***> wrote:
So sorry for the delay.
I would love to chat to get this up and running. When I get off of work, I'll do my best to connect with you.
Joshua, how are you doing? Need me to do anything?
Also, are you guys interested in my code that pulls data from wyze scale?
It's pretty robust, pulls all attributes, then has the capability of pushing those attributes to HA so it can be recorded statistically and historically.
I can upload it to Git if you guys want to take a look at it.
-- Jason Adams
On Sat, Sep 18, 2021 at 6:27 PM Joe Schubert @.***> wrote:
@lordlala https://github.com/lordlala
so, i got a chance to try and pull the data. unfortunately, the details you provided still don't work for me. On my test account where they're shared, I get an unauthorized error whenever I try to check the usage data (blame wyze's API).
If you could join into https://web.libera.chat/ channel: wyzeapi
just mention me by name so my app notifies me and I can try to get this figured out. I'm wondering if it just shows the same as the original plug's time based usage.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-922382469, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLHPHAVRU3LD5IXR753UCUG3JANCNFSM5CBV24XA .
Question - any particular reason you use wyzeapy instead of wyze_sdk? …
Wyzeapy is the library for this integration because it holds all the code that the first versions of this integration had (plus everything new). It would be a lot to change the backend for this integration.
Additionally wyzeapy has async support which works better with Home Assistant itself.
Hey guys, sorry I’ve kind of fallen off the radar. Some family issues :/.
So where do we stand with the outdoor plug?
Joshua, do you still need me to hop into that chat with you?
Thanks,
Jason Adams
On Sep 22, 2021, at 9:32 PM, Joshua Mulliken @.***> wrote:
Question - any particular reason you use wyzeapy instead of wyze_sdk? …
Wyzeapy is the library for this integration because it holds all the code that the first versions of this integration had (plus everything new). It would be a lot to change the backend for this integration.
Additionally wyzeapy has async support which works better with Home Assistant itself.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Hey, @lordlala we have not yet gotten started on energy monitoring. I do have an outdoor plug so that is something that I can try to get energy monitoring information from but I don't have much time for development. If you want to submit a PR for the change to wyzeapy and HA-WyzeAPI I could test it though and get it included. If you run into any issues the best way for us to troubleshoot and share knowledge is through the chat
My wife just bought one of the outdoor plugs as well, so I have access to the usage data as well now... But my dev time is probably going to be a bit limited for the next 2 months starting this week. So I'll see what I can do when I can do it.
Same as Joe, really, as far as being pretty tied up. But I definitely want to get my hands wet with this.
-- Jason Adams
On Sun, Oct 3, 2021 at 9:31 PM Joe Schubert @.***> wrote:
My wife just bought one of the outdoor plugs as well, so I have access to the usage data as well now... But my dev time is probably going to be a bit limited for the next 2 months starting this week. So I'll see what I can do when I can do it.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JoshuaMulliken/ha-wyzeapi/issues/229#issuecomment-933076573, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLMOLAMJ5Q6YPYSVWMAVXDUFD7YBANCNFSM5CBV24XA .
I'm trying to do some work on this, just posted on the Home Assistant forums for some advice as to how this might work in a sensor to collect the data. However, in case anyone's curious... Here's a sample of how this data looks for my outdoor plugs.
https://pastebin.com/hQPn28qT
The data comes back as an array as such:
each element looks like this:
{
"data": "[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",
"date_ts": 1636588800000
}
and during the next query of the API endpoint that same element can look like:
{
"data": "[0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",
"date_ts": 1636588800000
}
each field in the data array represents an hour, starting at the date_ts timestamp, which is GMT midnight on a date. The values will continue to update throughout the hour, so there's no guarantee that the fields will only update once then remain static. For instance, that 1 in the data became a 3 after running a heater on the plug for a little bit.
The value also represent 0.001 KWh. When it became 0.003KWh it was "data": "[0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",
Posting this here for record-keeping and in case anyone has an idea of how this might work in Home Assistant as a sensor. (I'm assuming a utility sensor set to total)
@lordlala would you be able to help me out with the model number for the switches that have the power usage? I have "WLPP1CFH" which does not... and "WLPPO" which is the outdoor plug and does. Given that Wyze doesn't really give a way to check for capabilities/features on the plug, I need to do a model check to ensure that we're only pulling this on devices which support it.
Just to update this issue with where I had gotten to on it... I still haven't been able to conceptualize a "good" way to do this. I'm open to suggestions.
https://github.com/yoinx/ha-wyzeapi/commit/f0a3accc10bd0bf3329a2fbfaec5ed05a1fa0024
In the update function at line 275... Basically, what I need to is get the latest value, then pass ha either zero or a lower value to signal that the new hour started.
The issues in this, during my testing, were as follows:
- Wyze only seemed to send updated values about every 20 minutes. I was looking the endpoint about one a minute during this, so I'm not sure if that's a fixed time or just when it happened to update.
- During this initial update for a new hour you may get updated values for the previous hour and the current hour at the same time. HA would need that last hour's value, then a 0, then the new hour's value passed to the sensor.
- This also needs to account for the previous hour being the last hour of the previous day.
Asking in HA's forums it doesn't sound like updating past hour sensor values are an option.
This depends on this change to wyzeapy. https://github.com/yoinx/wyzeapy/commit/3483b0e34a743f44df7947d5a003cb0196bdb59e I included a sample of what the data would look like at line 22 in the switch service.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.