skelgaard / homeassistant-apsystems

An APsystems Sensor for Home Assistant
Apache License 2.0
25 stars 9 forks source link

no sensors #18

Closed devano1701 closed 1 year ago

devano1701 commented 1 year ago

Still not working for me. I got this error earlier before the problems with the website. Until now it has never worked for me. I don't see the sensors. I get this error message:

Logger: homeassistant.components.sensor Source: custom_components/apsystems/sensor.py:247 Integration: Sensor (documentation, issues) First occurred: 09:40:45 (5 occurrences) Last logged: 09:40:53

apsystems: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, in async_device_update await task File "/config/custom_components/apsystems/sensor.py", line 142, in async_update ap_data = await self._fetcher.data() File "/config/custom_components/apsystems/sensor.py", line 247, in data timestamp_event = int(self.cache['time'][-1]) + offset_hours # apsystems have 8h delayed in timestamp from UTC TypeError: 'NoneType' object is not subscriptable

Maybe my timezone is not correct, but I don't know what to do. Please advice.

MORITZ0405 commented 1 year ago

turn sunset off

devano1701 commented 1 year ago

Doesn’t work. Same error.

daniel1204xx commented 1 year ago

Same issue for me .. I'm not able to get it running again ;(

devano1701 commented 1 year ago

It seems that in line 247 the value of self.cache is None. But why?

skelgaard commented 1 year ago

your self.cache is empty cause there is no data from that day from the system.

if you login at https://www.apsystemsema.com it will say 0 for today, therefor no data... i will se, i fix so it doesn't give an error on that, but it is of no matter for the system. If there should be data, then you need to check your modem is up and if the ema has data, do write again, i will look futher for error then

devano1701 commented 1 year ago

I use version 1.0.7 and line 247 is: “timestamp_event = int(self.cache['time'][-1]) + offset_hours # apsystems have 8h delayed in timestamp from UTC”

The error message is:

Logger: homeassistant.components.sensor Source: custom_components/apsystems/sensor.py:247 Integration: Sensor (documentation, issues) First occurred: 14:05:42 (5 occurrences) Last logged: 14:05:51

apsystems: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update await task File "/config/custom_components/apsystems/sensor.py", line 142, in async_update ap_data = await self._fetcher.data() File "/config/custom_components/apsystems/sensor.py", line 247, in data timestamp_event = int(self.cache['time'][-1]) + offset_hours # apsystems have 8h delayed in timestamp from UTC TypeError: 'NoneType' object is not subscriptable

Self.cache is empty because the response is 204 No Content.

After 5 occurrences (the 5 sensors ?) there are no more errors. I presume the process is stopped.

I don’t see any sensors from apsystems in HA.

When I access the website or use the app I do see content.

Op 23 nov. 2022, om 01:39 heeft skelgaard @.***> het volgende geschreven:

your self.cache is empty cause there is no data from that day from the system.

if you login at https://www.apsystemsema.com https://www.apsystemsema.com/ it will say 0 for today, therefor no data... i will se, i fix so it doesn't give an error on that, but it is of no matter for the system. If there should be data, then you need to check your modem is up and if the ema has data, do write again, i will look futher for error then

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1324406222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWVDECKGVEWJSIQVTPTWJVRT7ANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.

devano1701 commented 1 year ago

When I restart HA in the evening (I am living in NL) with sunset on, the sensor is not running. But now I see the 5 sensors from apsystems, but they are all not available. Maybe this gives you a clue.

Begin doorgestuurd bericht:

Van: @." @.> Onderwerp: Antw: [skelgaard/homeassistant-apsystems] no sensors (Issue #18) Datum: 23 november 2022 om 14:40:59 CET Aan: skelgaard/homeassistant-apsystems @.***>

I use version 1.0.7 and line 247 is: “timestamp_event = int(self.cache['time'][-1]) + offset_hours # apsystems have 8h delayed in timestamp from UTC”

The error message is:

Logger: homeassistant.components.sensor Source: custom_components/apsystems/sensor.py:247 Integration: Sensor (documentation, issues) First occurred: 14:05:42 (5 occurrences) Last logged: 14:05:51

apsystems: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 715, in async_device_update await task File "/config/custom_components/apsystems/sensor.py", line 142, in async_update ap_data = await self._fetcher.data() File "/config/custom_components/apsystems/sensor.py", line 247, in data timestamp_event = int(self.cache['time'][-1]) + offset_hours # apsystems have 8h delayed in timestamp from UTC TypeError: 'NoneType' object is not subscriptable

Self.cache is empty because the response is 204 No Content.

After 5 occurrences (the 5 sensors ?) there are no more errors. I presume the process is stopped.

I don’t see any sensors from apsystems in HA.

When I access the website or use the app I do see content.

Op 23 nov. 2022, om 01:39 heeft skelgaard @.***> het volgende geschreven:

your self.cache is empty cause there is no data from that day from the system.

if you login at https://www.apsystemsema.com https://www.apsystemsema.com/ it will say 0 for today, therefor no data... i will se, i fix so it doesn't give an error on that, but it is of no matter for the system. If there should be data, then you need to check your modem is up and if the ema has data, do write again, i will look futher for error then

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1324406222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWVDECKGVEWJSIQVTPTWJVRT7ANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.

skelgaard commented 1 year ago

the sensors are unavaliable untill there is data... when suset is on, it doesn't fetch data after the sun has gone down. they will not be up before first data the next day.

devano1701 commented 1 year ago

But on day time I get those errors because there is no content and the sensors stay unavailable.

Op 23 nov. 2022, om 21:15 heeft skelgaard @.***> het volgende geschreven:

the sensors are unavaliable untill there is data... when suset is on, it doesn't fetch data after the sun has gone down. they will not be up before first data the next day.

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1325609577, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWVYMT5SMRLNHYK6D5LWJZ3OXANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.

skelgaard commented 1 year ago

can you see any power generated on the ema site ?

try the commands in https://github.com/skelgaard/homeassistant-apsystems/issues/15#issuecomment-1322361350

i have pushed a new version, that should remove the errors in the log for no data, as it isn't really an error.

devano1701 commented 1 year ago

Oke, I am not a real expert.

On the GET the response is 200, with a lot of content.

On the POST the response is 204, with the message: The content type of response is application/json, while response body is not a valid json string

I am using REST Client in VS Code.

Maybe I didn’t format the POST correctly.

Op 23 nov. 2022, om 22:19 heeft skelgaard @.***> het volgende geschreven:

can you see any power generated on the ema site ?

try the commands in #15 (comment) https://github.com/skelgaard/homeassistant-apsystems/issues/15#issuecomment-1322361350 i have pushed a new version, that should remove the errors in the log for no data, as it isn't really an error.

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1325667679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWU5F323USM3C6N5QODWJ2C6RANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.

skelgaard commented 1 year ago

204 means no data.

if you go into the ema is any production from today ?

devano1701 commented 1 year ago

Yes,

I see production on the website and in the app.

Op 23 nov. 2022, om 22:59 heeft skelgaard @.***> het volgende geschreven:

204 means no data.

if you go into the ema is any production from today ?

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1325707008, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWQ5B66DOKLXHQXCIULWJ2HURANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.

skelgaard commented 1 year ago

if you get 204 in vscode, there either is no data or you may have added wrong keys in it

devano1701 commented 1 year ago

There sure is data, so something must be wrong with the POST. As I mentioned, I am not an expert. I did check the keys, they are ok. I presume my POST command is not correctly formatted. I will get some local help tomorrow and try again. For now: thanks a lot for the support so far.

Op 23 nov. 2022, om 23:20 heeft skelgaard @.***> het volgende geschreven:

if you get 204 in vscode, there either is no data or you may have added wrong keys in it

— Reply to this email directly, view it on GitHub https://github.com/skelgaard/homeassistant-apsystems/issues/18#issuecomment-1325722587, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7YNWU3QCT3YS6TTETUFODWJ2KCTANCNFSM6AAAAAASHT2QNI. You are receiving this because you authored the thread.