Johboh / hassalarm

Android app for integration with Hass.io as a sensor for the next scheduled alarm on the device
MIT License
62 stars 6 forks source link

stopped working #23

Closed goosst closed 3 years ago

goosst commented 3 years ago

Hello,

I have something very strange, the app worked fine but stopped working for some reason on 19 december. Now, if I try to replicate what's in the log in python on my laptop it doesn't work either ...

from requests import get,post
import json
import headerfiles as parameters
headers=parameters.headers
address_hass=parameters.address_hass

url='http://'+address_hass+':8123/api/services/input_datetime/set_datetime'

payload='{"entity_id": "input_datetime.next_alarm","timestamp": "1609911060"}'

test=post(url,data=payload,headers=headers)
test.text

This leads to '400: Bad Request' (same messages as on my phone).

However, if I change the payload to payload='{"entity_id": "input_datetime.next_alarm","datetime": "2020-01-06 06:31:20"}', it works fine.

So I'm wondering if something went wrong with using this timestamp payload?

regards Stijn

Johboh commented 3 years ago

Hello! What version of Home Assistant are you using? In your example above, the timestamp value should be an integer and not a string. Eg: payload='{"entity_id": "input_datetime.next_alarm","timestamp": 1609911060}' and not payload='{"entity_id": "input_datetime.next_alarm","timestamp": "1609911060"}'

goosst commented 3 years ago

Hello

thanks for the quick reply. I'm using Home Assistant 0.112.5

I've tried these three payloads:

payload='{"entity_id": "input_datetime.next_alarm","datetime": "2020-01-06 06:31:20"}'
# payload='{"entity_id": "input_datetime.next_alarm","timestamp": "1609911060"}'
# payload='{"entity_id": "input_datetime.next_alarm","timestamp": 1609911060}'

only the first one doesn't throw the 400 error.

You start to miss this app quickly :+1:

Johboh commented 3 years ago

@goosst 0.112 is quite an old home assistant release, can you try upgrading to any of the 2020.x versions? Eg 2020.12.1 or newer.

goosst commented 3 years ago

Maybe if it's a rainy weekend and I can fix all things that break while upgrading ;)

Johboh commented 3 years ago

@goosst Yes sorry! I always read the breaking changes in the release logs and upgrade often to keep it from breaking too much :). But I understand the hassle. I also keep all configuration files in git, and run hass in a docker container, so if something breaks to much I can just roll back.

goosst commented 3 years ago

upgrade went smooth ... I can confirm hassalarm is working now

Johboh commented 3 years ago

@goosst great to hear that you had some rain. I'm closing this now.