sqall01/alertR

ICalendar exit code 1

cerikss8 opened this issue · 5 comments

Hi! I'v tryed to setup ICalendar as a sensor with as per your tutorial "Developer CalendarSchedule" to trigger a door lock.
On the server I have i alertLevel no:30 set for ICalendar with the script - calendar_schedule.py.
I set a schedual time to trigger "alertLevel: 30" and "state: 1" and the ICalendar trigger but the internal Instrumentation throws me an error "exit code (1)" and after that it dosn't register when the calendar send "state: 0".
I do miss something in the script otherwise it would not throw an error or.....

/Clas

Hi,

can you please take a look into the server log files. The server should not only log that an "exit code 1" occurred, but also the output of the instrumentation script. With this, we could better understand what is going wrong.

The log entries should look something like the following:

Instrumentation for Alert Level '30' exited with exit code '1'
Instrumentation for Alert Level '30' stdout: <some output>
Instrumentation for Alert Level '30' stderr: <some output>

Cheers,
Andre

Hi!
This is the output:
07/01/2021 10:44:00 ERROR: [instrumentation.py]: Instrumentation for Alert Level '30' exited with exit code '1'.
07/01/2021 10:44:00 ERROR: [instrumentation.py]: Instrumentation for Alert Level '30' stdout: Sensor Alert argument '{"nodeId": 12, "sensorId": 12, "description": "Google Calendar", "timeReceived": 1625129040, "alertDelay": 0, "state": 1, "hasOptionalData": true, "optionalData": {"message": "Failed more than 10 times for 'clas.eriksson@gmail.com' to retrieve calendar data.", "calendar": "clas.eriksson@gmail.com", "type": "timeout"}, "changeState": true, "alertLevels": [30], "hasLatestData":false, "dataType": 0, "data": null, "instrumentationAlertLevel": 30}' invalid: Optional Data does not hold description data.
07/01/2021 10:44:00 ERROR: [instrumentation.py]: Instrumentation for Alert Level '30' stderr:
07/01/2021 10:44:00 ERROR: [alert.py]: Instrumentation for Sensor Alert 'Google Calendar' failed.

Okay! I can see that there is some problem with connecting to google account. But the sensor it self connect to calendar because it triggers so it seems like the script do not get access to calendar data.
I see in the json string that alertLevel is named "alertLevels"

Br
/Clas

It looks like the ICalendar sensor seems not to be able to retrieve the calendar data from google. The Sensor Alert that was triggered here is an error from the ICalendar sensor which states it was not able to retrieve the data from google for more than 10 retries. And the type of error is described as timeout (perhaps the sensor is not able to reach the google server?).

Can you please check the log files of the ICalendar sensor to see what the issue is exactly?

P.S.
Yeah, I know. It is currently a little bit confusing because errors in the sensor and the state of the sensor are both handled via Sensor Alerts, but this is a open issue on my roadmap which I wanted to address in version 0.900.

Ah!! I'v got this out off logfile:
07/01/2021 15:33:39 ERROR: [icalendar.py] Server responded with wrong status code (404).

Pretty sneaky!! the sensor it self reports triggered as if it read the calendar but the log say's something else.
Whene I setup the calendar sensor in the begining I only looked for triggered state, and it did so I didn't felt any need to look in the log file, but now with the script and tripping of the internal instrumantation error I noticed that something was wrong.

I will check the reason why it can't connect and come back with some answer
I thought I had configured the google calendar correct but no!

It seems the issue is solved. Please re-open it if anything is still amiss.