Skip to content
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

Widget sends alarm code as float, fails comparison #640

Closed
peterk-code opened this issue Jun 28, 2020 · 0 comments · Fixed by #650
Closed

Widget sends alarm code as float, fails comparison #640

peterk-code opened this issue Jun 28, 2020 · 0 comments · Fixed by #650
Labels
bug Something isn't working widget

Comments

@peterk-code
Copy link

Home Assistant Android version:
1.9.0-167
Android version:
10
Phone model:
Pixel 3
Home Assistant version:
0.111.4
Last working Home Assistant release (if known):

Description of problem:
When trying to create a widget to trigger the 'alarm_control_panel.alarm_disarm' service, the widget appears to function correctly but generates an 'invalid code' error in alarm log. Inspecting the logged webhook from the mobile_app shows the code field appears to be sent as a float, and I believe that fails the compare in the alarm panel.
Traceback (if applicable):

2020-06-28 12:13:37 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload for type call_service: {'domain': 'alarm_control_panel', 'service': 'alarm_disarm', 'service_data': {'code': 1234.0, 'entity_id': 'alarm_control_panel.home_alarm'}}
2020-06-28 12:13:37 WARNING (SyncWorker_11) [homeassistant.components.manual.alarm_control_panel] Invalid code given for disarmed

Screenshot of problem:
Screenshot_20200628-113226

Additional information:
Alarm code in this example is: 1234

@peterk-code peterk-code added the bug Something isn't working label Jun 28, 2020
JBassett pushed a commit that referenced this issue Jul 7, 2020
* Widget service calls will fail, if a number for any field is used.
Because the GSON parser will parse every integer to a double.
This is especially a problem on the service alarm_control_panel.alarm_disarm
which needs a code to disarm the alarm panel.
So every code will be converted to .0 (eg. 1234 would be 1234.0)
Solution: Use Jackson instead of gson
GSON problem described here (not fixed):
google/gson#1084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working widget
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants