phier
(john)
March 22, 2022, 3:57pm
1
hello,
i need to apply a fix as a template
opened 08:57PM - 24 May 21 UTC
closed 03:50PM - 26 May 21 UTC
cannot fix ❌
<!--
🚨🚨🚨 STOP! STOP! STOP! 🚨🚨🚨
Before opening an issue, please read and fo… llow these steps:
1. Are you using HomeAssistant?
If yes, please open your issue at https://github.com/home-assistant/core/issues
UNLESS a developer told you to come here.
2. Check the troubleshooting section if your problem is described there:
https://zwave-js.github.io/zwavejs2mqtt/#/troubleshooting/bug_report
3. Check the changelog if your problem was already fixed recently.
https://github.com/zwave-js/zwavejs2mqtt/blob/master/CHANGELOG.md
We cannot provide support if you are not using the latest version.
4. Make sure to provide the necessary information, as described here:
https://zwave-js.github.io/zwavejs2mqtt/#/troubleshooting/bug_report
If you are using HomeAssistant, this is how you do it:
Home Assistant -> settings -> Integrations -> Z-Wave JS -> Configure -> Create dump -> zip the json file and post it here.
🙏🏻🙏🏻🙏🏻 Thanks, now onto your issue:
-->
### Version
**Checklist:**
- [x] I am **not** using HomeAssistant. **Or:** a developer has told me to come here.
- [x] I have checked the troubleshooting section and my problem is **not** described there.
- [x] I have read the changelog problem was **not** mentioned there.
Build/Run method
- [x] Docker
- [ ] PKG
- [ ] Snap package
- [ ] Manually built (git clone - yarn install - yarn run build )
zwavejs2mqtt version: 4.3.1
zwave-js version: 7.5.1
### Describe the bug
The `kWh` meter of the `NAS-WR01ZE` (https://devices.zwave-js.io/?jumpTo=0x0258:0x0200:0x1027:2.32) smart plug is reported/displayed as a negative number.
After resetting the accumulated meter values, sane positive values are reported for sometime, but at some point it flips to negative.
zwavejs2mqtt.log:
```
2021-05-24 20:46:26.806 DEBUG SOCKET: Event ZWAVE_API emitted to FHb1fJMDSyU3lbGJAAAB
2021-05-24 20:46:26.808 INFO ZWAVE: Calling api refreshCCValues with args: [ 42, 50, [length]: 2 ]
2021-05-24 20:46:26.971 INFO ZWAVE: Node 42: value updated: 50-0-value-65537 -21474836.13 => -21474836.13
2021-05-24 20:46:27.120 INFO ZWAVE: Node 42: value updated: 50-0-value-66049 27.85 => 27.49
2021-05-24 20:46:27.266 INFO ZWAVE: Node 42: value updated: 50-0-value-66561 234.62 => 234.93
2021-05-24 20:46:27.410 INFO ZWAVE: Node 42: value updated: 50-0-value-66817 0.25 => 0.25
```
zwavejs.log:
```
2021-05-24T20:46:26.811Z CNTRLR » [Node 042] querying meter value (type = Electric, scale = kWh, rate type = Con
sumed)...
2021-05-24T20:46:26.975Z CNTRLR » [Node 042] querying meter value (type = Electric, scale = W, rate type = Consu
med)...
2021-05-24T20:46:27.123Z CNTRLR » [Node 042] querying meter value (type = Electric, scale = V, rate type = Consu
med)...
2021-05-24T20:46:27.268Z CNTRLR » [Node 042] querying meter value (type = Electric, scale = A, rate type = Consu
med)...
```
The negative value also gets picked up by Home Assistant.
### To Reproduce
Let the device report for some time.
### Expected behavior
A sane number being reported.
### Additional context
*I am unsure if this is a SW issue or a quirk with the device itself, since it looks like bit 31 is being flipped.*
The screenshot below was made not too long after a reset of the accumulated values. If I take the negative number and flip bit 31 from 1 to 0, we get `35`, which would be `0.35` kWh I presume, and that would make sense given that a reset was done earlier.
This is happening on multiple of the same devices I own, not only a single one.
![image](https://user-images.githubusercontent.com/4130005/119406394-04428b00-bce3-11eb-9968-bfd0cfaab304.png)
specifically its Home Assistant Template Sensor - Shenzhen Neo NAS-WR01ZE Reported kWh Energy Correction · GitHub
but i have no idea how to do that? Do i have to create separate yaml file under config/ or do i have to add code into configuration.yaml?
thanks
Tinkerer
(aka DubhAd on GitHub)
March 22, 2022, 4:04pm
2
That can be added directly to configuration.yaml
, replacing sensor.my_device_power_electric_consumption_kwh
with your sensor entity.
Then run a command line config check:
ha core check
Before restarting HA
phier
(john)
March 22, 2022, 4:14pm
3
@Tinkerer its zwave device, its not inside configuration.yaml
petro
(Petro)
March 22, 2022, 4:22pm
4
The template is pasted into your configuration.yaml. And you replace the entity_id in the template with your zwave entity_id. That’s what tinkerer is saying.
phier
(john)
March 22, 2022, 4:24pm
5
@petro okay, i will try, there is no separate file like template.yaml or dir for that? thx
petro
(Petro)
March 22, 2022, 4:26pm
6
that depends on how you set up your system. If you don’t know, then you’ll just be putting that in configuration.yaml
phier
(john)
March 22, 2022, 4:28pm
7
but i am afraid it does not work…
i added
but i cant see / find Entity like that here >
its not even here…
phier
(john)
March 22, 2022, 4:30pm
9
well i did hm. i can do it again… but i did via ssh. reboot.
petro
(Petro)
March 22, 2022, 4:32pm
10
You don’t need to reboot, just restart home assistant. Make sure config check works.
phier
(john)
March 22, 2022, 4:33pm
11
not sure what does it mean to restart homeassistant,
but i now clicked on Restart Supervisor and its there.
But i don’t think it is working properly?
seems like pretty mess… in configuration its called
{% set value = states(‘sensor.wall_plug_switch_power_electric_consumption_kwh’) | float(‘unknown’) %}
in UI its sensor.usb_qc_charger_
petro
(Petro)
March 22, 2022, 4:36pm
12
Restart supervisor restarts the supervisor, not home assistant. You’d need to restart home assistant.
Configuration → Settings → Server Control tab → Restart
petro
(Petro)
March 22, 2022, 4:39pm
13
This creates a new entity that uses the other entity. You will have 2. It does not replace your existing entity.
phier
(john)
March 22, 2022, 4:39pm
14
seems broken even after restart…
even configuration.yaml
phier
(john)
March 22, 2022, 4:41pm
15
it says Unknown in status… so no clue.
petro
(Petro)
March 22, 2022, 4:42pm
16
you didn’t use the correct entity_id. You’re image shows the word power
in your template, where your entity_id on the other image does not have that word.
phier
(john)
March 22, 2022, 4:43pm
18
@petro ah now i got it … see your point … i will correct. Appreciate your help.
1 Like
petro
(Petro)
March 22, 2022, 4:48pm
19
I suggest you move to some other type of editing. Via SSH is a pita. You can setup samba share to access the files from another machine or use the Visual Studio Code addon.