asantaga / lightwaverf_HA_EnergySensor

Home Assistant Sensor for the LightwaveRF energy monitor
MIT License
5 stars 3 forks source link

Multiple Energy Monitors #2

Open MJP-76 opened 4 years ago

MJP-76 commented 4 years ago

@asantaga

I have my energy monitor working well now and have just added another energy monitor to my LightWave HUB as I have two electricty feeds I want to monitor 1 x main utility feed into my house and then to a sub db to my Annexe that I want to monitor

Do you support multipl monitor sensor? I am testing now so may find the answer myself soon

They are showing in my lightwave portal fine so assume they send data based on serial number or ID to the HUB which you could possible use in the sensor name to distinguise the different monitors

asantaga commented 4 years ago

hey there, just returned from hols :-) I havent tested multiple monitors because I only have one supply :-) but it probably does work.. From looking at the API (https://api.lightwaverf.com/energy.html), there is a serial number emitted so Im guessing this would actually work..

let me think about how I would implement this.... without having a separate supply ,....

asantaga commented 4 years ago

Do you have two separate monitors?

MJP-76 commented 4 years ago

Yep, Have two seperat monitors on a singe Hub

asantaga commented 4 years ago

Matt

Can you run this gist on your machine and let me know the output

https://gist.github.com/asantaga/308f3a2fc59172e9f272d52a29a25e5b

If its linux make sure port 9761/UDP is already open (probably already done this i guess)

MJP-76 commented 4 years ago

Sorry, I have been away on business and really slammed

What did you need me to do with that gist, I have not used gist before

asantaga commented 4 years ago

Hey like you very busy with work :-)

Download the python code to your machine and give it a swirl.. It will listen for events from the energy sensor and print them out on the console

are you on linux or windows?

On Wed, 24 Jul 2019 at 19:08, matthewjporter notifications@github.com wrote:

Sorry, I have been away on business and really slammed

What did you need me to do with that gist, I have not used gist before

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/asantaga/lightwaverf_HA_EnergySensor/issues/2?email_source=notifications&email_token=AAWN2QG7POKBITTQSZEUS2TQBCLCDA5CNFSM4H6J3ZN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2XE3WY#issuecomment-514739675, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWN2QGZJRQGVNKZCSVTOSDQBCLCDANCNFSM4H6J3ZNQ .

--

Angelo

MJP-76 commented 4 years ago

After such a long time away and caught up in many other project, which I am sure you are also busy I Finaly got around to running on a ubuntu box I have

Here are my results

Data received from LWRF Energy !{"trans":25,"mac":"20:40:A8","time":1591027035,"pkt":"868R","fn":"meterData","prod":"pwrMtr","serial":"DB81FE","type":"energy","cUse":1363,"todUse":46} Waiting for data from LWRF Energy Device Data received from LWRF Energy !{"trans":26,"mac":"20:40:A8","time":1591027057,"pkt":"868R","fn":"meterData","prod":"pwrMtr","serial":"CF50FE","type":"energy","cUse":147,"todUse":4} Waiting for data from LWRF Energy Device Data received from LWRF Energy !{"trans":27,"mac":"20:40:A8","time":1591027065,"pkt":"868R","fn":"meterData","prod":"pwrMtr","serial":"DB81FE","type":"energy","cUse":1375,"todUse":52} Waiting for data from LWRF Energy Device Data received from LWRF Energy !{"trans":28,"mac":"20:40:A8","time":1591027072,"pkt":"868R","fn":"meterData","prod":"pwrMtr","serial":"CF50FE","type":"energy","cUse":144,"todUse":4}

As you can see, it shows the "serial":"xxxxxx" for both devices

As per initial request, I have two devices as I have one in my "Main" utility meter and then a "Secondary" for an Annexe and would like to see both in HA Screen Shot 2020-06-01 at 16 14 53

Is it easy to make change/add the serial number into the sensor names so they match up a bit more to the LWRF webpage?

somthing like sensor.lwrffenergy_serialnumber_current_use and sensor.lwrfenergy_serialnumber_today_total

Am going to try and and see If i can do it, but not that good at coding so would really appreciate if you were able to do get more than one energy device sensor

I have running via Hacs but if you need me to test, I can install as a custom component directly

Thanks in advance

asantaga commented 4 years ago

hey, thanks for this.

Good to see serial# is the right value. I can easily change the code so that it creates two entities.. I'll see when I can get to do it .... I also need to change the code to be async so that HA likes it "more" :-)