Open siliconkibou opened 2 years ago
There should now be a beta where sensors are implemented for all the powermeters (some might make more sense than others). However, I did not test my changes; i.e., there might be a typo or logic mistakes and therefore buggy behavior.
It is possible to install the version where the additional sensors are implemented with
sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta
The config fields that need to be enabled are added to the README
Please report back if everything works.
Really appreciate the rapid response! I've updated to the beta and added the appropriate "feedingToSensor" and. "pullingFromSensor" true values where applicable. I've restart HB and all existing devices seem to be operable.
I'm not seeing these new sensors appear in HomeKit however. Only PowerWall related sensors I see are still the preexisting Grid Up and Grid Down ones.
Ok. Next try is installable with sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta2
That seems to work! Thanks! Immediately after updating and restarting HB however I did get a sea of "Request failed: Error: connect EHOSTUNREACH" messages I'd never seen before and the PowerWall gateway was inaccessible via browser/HTTP as well.
Possibly no link between the two, but it seemed connected. Took some hours before it was working again. (I could still access via the Tesla app, and internet connectivity was up). Just mention it in case something was accidentally introduced.
Ok, nice :)
Hm, yeah. I do not think that the error could be related to the changes. Thanks for also writing your findings in #33.
Oh. Also, I hope that the "feeding" and "pulling" is semantically correct. Switching the "feeding" and "pulling" descriptions/semantics is easily possible for an individual powermeter.
Currently a negative power value is "feeding" and a positive power value is "pulling" on all of the powermeters.
Yeah. I think it needs to adjust some with context. For solar of course there will never be a "feeding to". I think the Battery and Grid labels make since. For Home however, I think maybe it should be inverted. "Pulling From" when the home is consuming power doesn't really make semantic sense, which is how it behaves now.
In fact, I'm not sure there should ever be a "pulling from" (when do we pull energy from the house)? So like the Solar there should only one sensor, so like:
Solar: Pulling from Home: Feeding to Grid: (works well with Pulling from and Feeding to as is) Battery: (I think this works well too)
The only other observation I have is that I wonder if some smoothing should be done. For instance, right now I'm running on grid power and the battery is not in the mix (neither pulling or feeding). It does seem to have a small ebb and flow reported from the Gateway, so that makes the plugin flip-flop pretty regularly between Feeding to and Pulling From (when practically speaking it's doing neither, even if technically it is.
Perhaps a minimum integer threshold before the sensor is triggered (for instance more or less than -50 through 50)?
I did work a bit on the sensors. (For the near future, progress will probably stay similarly sporadic..)
Relevant to the threshold implementation:
Cool - thanks. In my opinion, I would chose the latter option (when close to zero the sensors are not active). This should smooth out any small blips in activity, but still capture when current is truly and practically flowing (which is what we really want to know with these sensors).
Thank you very much for your job. Very interesting. I have already installed the latest stable version, but I am very interested about the new functionalities (sensor for Grid activity. I would use it to manage an heat pump to operate with more power in conditions of extra FV production). So, are the new features discussed here already present in beta2 (feeding to, polling from, threshold, etc.)? Tnx
@gnoto Yes, basic sensors are implemented in the beta2. But the mentioned peculiarities still exist:
Me:
Oh. Also, I hope that the "feeding" and "pulling" is semantically correct. Switching the "feeding" and "pulling" descriptions/semantics is easily possible for an individual powermeter.
Currently a negative power value is "feeding" and a positive power value is "pulling" on all of the powermeters.
siliconkibou:
Yeah. I think it needs to adjust some with context. For solar of course there will never be a "feeding to". I think the Battery and Grid labels make since. For Home however, I think maybe it should be inverted. "Pulling From" when the home is consuming power doesn't really make semantic sense, which is how it behaves now.
In fact, I'm not sure there should ever be a "pulling from" (when do we pull energy from the house)? So like the Solar there should only one sensor, so like:
Solar: Pulling from Home: Feeding to Grid: (works well with Pulling from and Feeding to as is) Battery: (I think this works well too)
The only other observation I have is that I wonder if some smoothing should be done. For instance, right now I'm running on grid power and the battery is not in the mix (neither pulling or feeding). It does seem to have a small ebb and flow reported from the Gateway, so that makes the plugin flip-flop pretty regularly between Feeding to and Pulling From (when practically speaking it's doing neither, even if technically it is.
Perhaps a minimum integer threshold before the sensor is triggered (for instance more or less than -50 through 50)?
I.e., there is no threshold value and there may be changes in further releases that might "break" your automation like renaming things and switching "feed" and "pull" around; be careful with future updates.
But as I very likely will not get to work on this feature this month, it might make sense to just use it for the time being. Any feedback would of course also be appreciated (like how the threshold should be implemented etc.)
You can install it with the npm command given above. The related settings ("feedingToSensor"
and "pullingFromSensor"
) can be found here: https://github.com/datMaffin/homebridge-tesla-powerwall/blob/7186baace776ce1cffd5e86bef0a6cf1f446f50e/README.md
The additional threshold
options that can be seen on the regular GitHub page and the fix for the "feed pull" terminology might only work when installing directly from GitHub; there is no release on npm that includes them.
Thank you so much for your answer. I'll do some experiments with the current version and come back to you with my observations. I look forward to the next release.
I observed the behavior of the current (beta) version. The grid sensor behaves like an NC (normal close) contact, ie it is "closed" when it is not active and "open" when it is activated. Often the logic is reversed (NO, normal close), but this is not a problem. In my version, even configuring the "sensorThreshold", this has no effect. In my opinion, the threshold should define an area within which the "sensor" is not activated. Example with "sensorThreshold" = 100:
Hope it's useful! Thanks
@datMaffin Any news here? tnx
@datMaffin Any news here? tnx
I did not yet continue to work on it, but I now would have the time available.
@datMaffin do you have any news for this issue/features?
this relates to the topic title, but not really the content going on in here
but I just want to ask @datMaffin , when we use sensorthreshold, how do we properly express what we want to happen
it is currently (by default, with 0's) showing the watt usage... ex: solar is generating 5000.... if I want this to show in kw, so it shows 5.0 instead, what do I have to put for the value after sensorthreshold?
this relates to the topic title, but not really the content going on in here
but I just want to ask @datMaffin , when we use sensorthreshold, how do we properly express what we want to happen
it is currently (by default, with 0's) showing the watt usage... ex: solar is generating 5000.... if I want this to show in kw, so it shows 5.0 instead, what do I have to put for the value after sensorthreshold?
The sensorthreshold
option does not influence the view of the powermeters at all.
The powermeter service that is supported by Eve.app will show the watts as they are; I would guess that it should decide on its own whether kW will be more readable and switch to this.
Using the fans as visualization in Homekit, I could theoretically add an option that will then make sure that the value seen in there will be divided by 1000. But the issue I see with this is that it is probably not possible to show numbers after the comma, which would result in a pretty rough display of current power.
@datMaffin do you have any news for this issue/features?
Not really, theoretically it should be pretty fast to complete. I am currently just procrastinating.
I could theoretically add an option that will then make sure that the value seen in there will be divided by 1000. But the issue I see with this is that it is probably not possible to show numbers after the comma, which would result in a pretty rough display of current power.
I would love that option, but that's up to you if you'd like to implement. the Tesla app shows in x.x not in xxxx, so it would be nice (for me) to match that, as I'm not concerned particularly with the exactness of the watt, but like you right "rough display" which is what the Tesla app shows
There is now a Beta3 installable: sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta3
It changed
Please report back if everything works as expected and whether the documentation (README) is clear enough.
@datMaffin All right. I just installed beta 3. In the next few days I will observe the behavior and give you feedback. Thank you
There is now a Beta3 installable:
sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta3
It changed
- the "feeding to" and "pulling from" terminology hopefully make sense now
- removed sensors that do not make sense (like feeding to solar)
- the threshold value should now act as a deadzone
Please report back if everything works as expected and whether the documentation (README) is clear enough.
I've done some tests but it doesn't seem to work. First, the sensorThreshold does not seem to have any effect. Setting it to a high value (example 300) also low values from the Grid (example 30) activate the sensors. Furthermore, even with zero value of Grid, the sensors remain active (sometimes both).
OK, sorry. I did find some stuff to fix (apparently I previously tried to implement the same thing halfheartedly).
sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta4
Ok tnx. I just installed beta 4 and will observe the behavior in the next few days. I'll come back with the results.
I'm afraid there is still some problem (or I didn't understand the implemented logic).
Here are my observations.
Version 3.1.0-Beta4 sensorThreshold: 200
Grid value -3875 -> "feeding to" active (open), "pulling from" not active (closed) Grid value -39 -> "feeding to" active (open), "pulling from" not active (closed) Grid value off (it's zero?) -> "feeding to" active (open), "pulling from" not active (closed) Grid value 50 -> "feeding to" not active (closed), "pulling from" active (open) Grid value 5984 -> "feeding to" not active (closed), "pulling from" active (open)
I am not yet sure when I am going to able to upload the next beta. (Worst case ~next week)
I looked at my code and I think I read the sensorthreshold from the wrong value, which results in it being always 0:
There is now sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta5
Installed beta 5. I'm going to testing.
Here are some of my observations with unexpected results
Version 3.1.0-Beta5 sensorThreshold: 500
Grid value off -> "feeding to" not active (closed), "pulling from" not active (closed) -> expected Grid value -40 -> "feeding to" active (open), "pulling from" not active (closed) -> not expected Grid value off -> "feeding to" not active (closed), "pulling from" active (open) -> not expected Grid value 23 -> "feeding to" not active (closed), "pulling from" active (open) -> not expected Grid value 21 -> "feeding to" active (open), "pulling from" active (open) -> not expected Grid value -65 -> "feeding to" active (open), "pulling from" not active (closed) -> not expected
All the above cases should result with both sensors not active (closed) instead in only one case this happens
@datMaffin Any news here?tnx
I recently got more busy again (last few months).
Also, I find it embarrassing how many tries this small feature already took. I would like to make sure that the next change is somehow tested by me in some way (which would of course require me to spend more time).
I recently got more busy again (last few months).
Also, I find it embarrassing how many tries this small feature already took. I would like to make sure that the next change is somehow tested by me in some way (which would of course require me to spend more time).
All right If it is useful I can be a tester for you. I already have a test environment! ;) Thank you
I finally recreated my setup for me being able to do basic testing of the plugin.
I am pretty sure that everything except for the sensorThreshold
already worked in Beta 5. Sadly the sensorThreshold
was always set to 0 because the defaultValue
function just always set it to 0 even if there was a value provided. Apparently I expected the defaultValue
function to only be used with true
and false
and not with numbers...
For the confusing case of the Grid being off, I believe that it was close to 0, but not equal to 0; which is the reason why the sensor was still open.
There is now a Beta 7 installable:
sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta7
I finally recreated my setup for me being able to do basic testing of the plugin.
I am pretty sure that everything except for the
sensorThreshold
already worked in Beta 5. Sadly thesensorThreshold
was always set to 0 because thedefaultValue
function just always set it to 0 even if there was a value provided. Apparently I expected thedefaultValue
function to only be used withtrue
andfalse
and not with numbers...For the confusing case of the Grid being off, I believe that it was close to 0, but not equal to 0; which is the reason why the sensor was still open.
There is now a Beta 7 installable:
sudo npm install -g homebridge-tesla-powerwall@3.1.0-Beta7
Thanks. I'm going to test
@datMaffin I have been able to check the different conditions and now it seems to work correctly Well done! Thank you
@gnoto - would you mind sharing the config that you settled on? thank you
@gnoto - would you mind sharing the config that you settled on? thank you
@nmuldoon Yes, of course. But it's very simple.
{
"platform": "TeslaPowerwall",
"name": "Tesla Powerwall",
"ip": "192.168.xx.xx",
"password": "xxxx",
"port": "",
"username": "customer",
"email": "xxx.xxx@xxx.com",
"loginInterval": 39600000,
"pollingInterval": 15000,
"historyInterval": 300000,
"lowBattery": 20,
"additionalServices": {
"powerwall": {
"homekitVisual": true,
"eveHistory": false,
"batteryIsLowSwitch": false,
"batteryIsChargingSwitch": false,
"makeOnOffSwitchReadOnly": true
},
"solar": {
"homekitVisual": true,
"evePowerMeter": false,
"eveHistory": false,
"eveLineGraph": false,
"pullingFromSensor": false
},
"grid": {
"homekitVisual": true,
"positiveEvePowerMeter": false,
"negativeEvePowerMeter": false,
"eveHistory": false,
"eveLineGraph": false,
"feedingToSensor": true,
"pullingFromSensor": true,
"sensorThreshold": 500
},
"battery": {
"homekitVisual": true,
"positiveEvePowerMeter": false,
"negativeEvePowerMeter": false,
"eveHistory": false,
"eveLineGraph": false,
"feedingToSensor": false,
"pullingFromSensor": false
},
"home": {
"homekitVisual": true,
"evePowerMeter": false,
"eveHistory": false,
"eveLineGraph": false,
"feedingToSensor": false
},
"gridstatus": {
"gridIsDownSwitch": true,
"gridIsUpSwitch": true,
"gridIsNotYetInSyncSwitch": true,
"gridIsDownSensor": false,
"gridIsUpSensor": false
}
}
}
Thank you @gnoto
Great work here, first of all.
I would like to be notified if the system is feeding to the grid (or pulling power from the grid), and the cleanest way to do this, it seems, would be to expose HomeKit sensors that can trigger native notifications.