-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle incorrect values reported by some Shelly devices #55042
Handle incorrect values reported by some Shelly devices #55042
Conversation
Hi @mkrasowski, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
Hey there @balloob, @bieniu, @thecode, @chemelli74, mind taking a look at this pull request as it has been labeled with an integration ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the documentation I only find -1
for the vibration sensor (which is missing in this PR) and in this case -1
means the sensor is disabled so we should use the removal_condition
and not the available
property.
Can you point to where you found the description in the Shelly API docs?
@thecode Look at the DW2 CoIoT description file: {
"I":3108,
"T":"S",
"D":"dwIsOpened",
"R":[
"0/1",
"-1"
],
"L":1
},
{
"I":3106,
"T":"L",
"D":"luminosity",
"U":"lux",
"R":[
"U32",
"-1"
],
"L":1
},
{
"I":3111,
"T":"B",
"D":"battery",
"R":[
"0/100",
"-1"
],
"L":2
}, You're right, also |
I have asked Shelly developers for the correct behavior of |
Thanks for your comments. I haven't included As @bieniu mentioned, according to the specification I'm somewhat reluctant to use I don't know if you have access to all the content in the linked Shelly Support Forum post, so I'm posting my findings also below:
|
The Current RC release already fixes that, as for the CoAP description, it only shows that P.S you can easily test vibration and tilt, no need to do anything, just disable them on the web interface and on latest RC version you will see that they are reported as |
You're right that cycling through an unavailable state might be incorrect, but since Even though technically the device is not unavailable, practically the sensor is unavailable since it's reporting invalid/unreliable values. I'm not sure what would be a better way of handling I'm curios what Shelly devs say. Please keep us updated. Thanks. |
Reply from Shelly is that the following sensors may generate For Thanks |
Thanks! I'd say Though, I think we still need to be careful with removing them right after receiving I'd say for this PR, let's merge it and open a new issue for |
Proposed change
This Pull Request fixes a problem with incorrect values sometimes reported by some Shelly devices.
The most impactful instance of this problem is Shelly Door/Window2 reporting door opening and closing within 1-2 seconds when the devices incorrectly submits
dwIsOpened
parameter with value-1
.Other fixed sensors:
battery
reported as-1%
,luminosity
reported as-1
,temperature
reported as-1
.Type of change
Additional information
I couldn't find any related open GitHub issues, but there is a thread on Shelly's Official Support Forum: https://www.shelly-support.eu/forum/index.php?thread/10839-shelly-door-window-2-state-changes/ (disclosure: I'm a participant as "mk-usa").
Looks like Alterco Robotics (the manufacturer) is aware of the problem and is working on a firmware update to correct this behavior upstream, but regardless of that, I think Home Assistant still has to handle these values appropriately, especially that they are listed in the CoIoT/COAP specification for Shelly DW2 device (https://shelly-api-docs.shelly.cloud/gen1/#shelly-door-window-1-2-coiot).
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: