Closed mikesierra555 closed 1 year ago
After restart, the below log entry popped up:
This error originated from a custom integration.
Logger: homeassistant.config_entries Source: custom_components/olarm_sensors/olarm_api.py:524 Integration: Olarm Sensors (documentation, issues) First occurred: 2:53:38 PM (1 occurrences) Last logged: 2:53:38 PM
Error setting up entry Olarm Sensors for olarm_sensors Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/olarm_sensors/init.py", line 69, in async_setup_entry devices = await setup_api.get_olarm_devices() File "/config/custom_components/olarm_sensors/olarm_api.py", line 524, in get_olarm_devices olarm_resp = await response.json() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://apiv4.olarm.co/api/v4/devices')
API call
{"deviceId":"*", "deviceName":"4 Guernsey St", "deviceSerial":"*",] "deviceAlarmType":"paradox", "deviceAlarmTypeDetail":null,"deviceTimestamp":1684241946901, "deviceStatus":"online", "deviceState":{"timestamp":1684241919419, "cmdRecv":0,"type":"", "areas":["notready", "notready"], "areasDetail":["",""], "areasStamp":[1684219169102,1684210144406], "zones":["c","c","a","a","c","c","c","a","c","c","c","c","c","c","c","c","c","c","c","a","c","c","c","c"], "zonesStamp":[0,1684086058079,1684241919428,1684241919429,0,1684070090623,0,1684220903112,1684237055481,1684163735094,0,1683733073016,1684239037178,1684240117973,1684219281735,1684160312760,1684240177934,1684240177935,1683998417233,1684210814969,1684172081385,null,null,1684236454981],"pgm":["c","c","c","c","c","c","c","c"],"pgmOb":["c","c"],"ukeys":[],"power":{"AC":"1","Batt":"1"}},"deviceProfile":{"ver":3,"areasLimit":2,"areasLabels":["",""],"zonesLimit":24,"zonesLabels":["Zone 01","Panic","Garden PIR","Lane PIR","Front Garden PIR","Electric Fence","Driveway Beam","Garage","Garage PIR","Front Door","Dining Room Windows","Lounge Windows","Patio Door","Lounge PIR","Kitchen Door","Kitchen Windows","Kitchen PIR","Passage PIR","Trap Door","Main Bedroom Windows","Main Bedroom PIR","TV Room Windows","Rahma Room Windows","Rahma Room PIR","Zone 25","Zone 26","Zone 27","Zone 28","Zone 29","Zone 30","Zone 31"],"zonesTypes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,""],"pgmLimit":8,"pgmLabels":["Panic Radio","Burglary Radio","Status LED","Open/Close Radio","Output 05","Output 06","Output 07","Output 08"],"pgmControl":["000","000","000","000","000","000","000","000"],"ukeysLimit":16,"ukeysLabels":["","","","","","","","","","","","","","","",""],"ukeysControl":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"fenceLabels":[""],"fenceZonesLabels":["","","",""],"fenceGatesLabels":["",""],"fenceZoneLimit":0,"fenceGateLimit":0},"deviceTriggers":{"ver":1,"lastCheck":0,"areasRemind":[[0,0],[0,0]],"zonesIdle":[0,0],"zonesWatch":[[0,0],[0,0]]},"deviceTimezone":"Africa/Harare","deviceFirmware":"3003.00500900000"}
Hi @mikesierra555, This issue has been fixed in 2.0.9
Hi @rainepretorius
Thank you, but my issue still appears unresolved. Now getting a 404 error also, despite the html API call returning a normal response. Error below is repeat for button, switch and binary_sensor.
Error while setting up olarm_sensors platform for alarm_control_panel Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/olarm_sensors/alarm_control_panel.py", line 37, in async_setup_entry await coordinator.async_get_data() File "/config/custom_components/olarm_sensors/coordinator.py", line 157, in async_get_data return await self.update_data() File "/config/custom_components/olarm_sensors/coordinator.py", line 94, in update_data self.data = await self.api.get_sensor_states(devices_json) File "/config/custom_components/olarm_sensors/olarm_api.py", line 123, in get_sensor_states time.ctime(int(olarm_state["zonesStamp"][zone]) / 1000), TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Wil Look into it and push a fix asap.
Hi,
My entities also disappeared after update to 2.1.0
I get this error for all entity types (button, switch, binary_sensor, alarm_control_panel)
2023-05-25 09:28:29.271 ERROR (MainThread) [homeassistant.components.button] Error while setting up olarm_sensors platform for button
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/olarm_sensors/button.py", line 28, in async_setup_entry
await coordinator.async_get_data()
File "/config/custom_components/olarm_sensors/coordinator.py", line 156, in async_get_data
return await self.update_data()
File "/config/custom_components/olarm_sensors/coordinator.py", line 111, in update_data
change_json = await self.api.get_changed_by_json(i + 1)
File "/config/custom_components/olarm_sensors/olarm_api.py", line 66, in get_changed_by_json
changes = await response.json()
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://apiv4.olarm.co/api/v4/devices/REDACTED/actions')
I regenerated API key and reconfigured integration.
Testing in the browser I get valid response from devices api call
https://apiv4.olarm.co/api/v4/devices/REDACTED?accessToken=REDACTED
But the GET on actions (noted in HA error) returns Forbidden
https://apiv4.olarm.co/api/v4/devices/REDACTED/actions?accessToken=REDACTED
The GET on events works fine though
https://apiv4.olarm.co/api/v4/devices/REDACTED/events?accessToken=REDACTED
Maybe an issue with Olarm API?
Hi,
My entities also disappeared after update to 2.1.0
I get this error for all entity types (button, switch, binary_sensor, alarm_control_panel)
2023-05-25 09:28:29.271 ERROR (MainThread) [homeassistant.components.button] Error while setting up olarm_sensors platform for button Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/olarm_sensors/button.py", line 28, in async_setup_entry await coordinator.async_get_data() File "/config/custom_components/olarm_sensors/coordinator.py", line 156, in async_get_data return await self.update_data() File "/config/custom_components/olarm_sensors/coordinator.py", line 111, in update_data change_json = await self.api.get_changed_by_json(i + 1) File "/config/custom_components/olarm_sensors/olarm_api.py", line 66, in get_changed_by_json changes = await response.json() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1104, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://apiv4.olarm.co/api/v4/devices/REDACTED/actions')
I regenerated API key and reconfigured integration.
Testing in the browser I get valid response from devices api call
https://apiv4.olarm.co/api/v4/devices/REDACTED?accessToken=REDACTED
But the GET on actions (noted in HA error) returns Forbidden
https://apiv4.olarm.co/api/v4/devices/REDACTED/actions?accessToken=REDACTED
The GET on events works fine though
https://apiv4.olarm.co/api/v4/devices/REDACTED/events?accessToken=REDACTED
Maybe an issue with Olarm API?
I have also been getting this issue on my Zone sensors. It seems like there is some issue with the api. Because I get a text response of Forbidden or Too many requests instead of the json data. To fix this regenerate your API key when the new update is pushed and do not use a refresh interval of less than 5 seconds.
Awesome, thanks Raine, worked like a charm!
Thanks for the update. I'm still getting the forbidden or "too many requests" text responses no matter what I try. Keep the issue closed. I'll send olarm a support request.
Thanks for the update. I'm still getting the forbidden or "too many requests" text responses no matter what I try. Keep the issue closed. I'll send olarm a support request.
I also mailed their CTO. We are currently in the process of trying to figure it out.
@rainepretorius any update from olarm?
I had a problem similar to issue #40 where my alarm_panel entities were unavailable after restart. The workaround was to delete and reinstall the integration, but now I have the problem that no entities are pulling through.
Attempted the following:
Latest log:
Logger: homeassistant.config_entries Source: helpers/entity_component.py:179 First occurred: 1:22:42 PM (15 occurrences) Last logged: 1:22:43 PM
Error setting up entry Olarm Sensors for alarm_control_panel Error setting up entry Olarm Sensors for binary_sensor Error setting up entry Olarm Sensors for button Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/alarm_control_panel/init.py", line 115, in async_setup_entry return await component.async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 179, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup!