roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
205 stars 32 forks source link

Payload & value errors in logs during HA startup #114

Closed auanasgheps closed 2 months ago

auanasgheps commented 1 year ago

Hi, when I start HA i get these two errors related to YiHack. What should I do to avoid them? Thanks

Logger: homeassistant.components.mqtt.number
Source: components/mqtt/number.py:206
Integration: MQTT (documentation, issues)
First occurred: 15:39:04 (6 occurrences)
Last logged: 15:39:05

Payload '
 { "SWITCH_ON":"yes", "SAVE_VIDEO_ON_MOTION":"yes", "SENSITIVITY":"low", "AI_HUMAN_DETECTION":"no", "FACE_DETECTION":"no", "MOTION_TRACKING":"no", "SOUND_DETECTION":"yes", "SOUND_SENSITIVITY":"50", "LED":"yes", "ROTATE":"no", "IR":"yes", "CRUISE":"off", "NULL":"NULL" }' is not a Number

and

Logger: homeassistant.helpers.template
Source: helpers/template.py:627
First occurred: 15:39:04 (6 occurrences)
Last logged: 15:39:05

Error parsing value: 'dict object' has no attribute 'PTZ_PRESET' (value: 
 { "SWITCH_ON":"yes", "SAVE_VIDEO_ON_MOTION":"yes", "SENSITIVITY":"low", "AI_HUMAN_DETECTION":"no", "FACE_DETECTION":"no", "MOTION_TRACKING":"no", "SOUND_DETECTION":"yes", "SOUND_SENSITIVITY":"50", "LED":"yes", "ROTATE":"no", "IR":"yes", "CRUISE":"off", "NULL":"NULL" }, template: {{ value_json.PTZ_PRESET | int }})
auanasgheps commented 3 months ago

Hi, bumping. After many updates to the Integration and the Camera firmware, I'm still seeing this issue. I've checked the camera configuration and values are all correct, nothing seems out of place, there are no invalid fields.

roleoroleo commented 3 months ago

I'm not able to link this error with a line of code of this integration. Is there an error trace? Are you sure that it's related to YI-hack? Did you enable mqtt advertise in the cam?

auanasgheps commented 2 months ago

Hi @roleoroleo Might not be related to the integration, but it's related to the camera, because the text/payload contains settings that are related to the camera.

MQTT Advertise settings section:

There is no error trace:

immagine

I thought it might be related to some of these camera settings, but i re-saved all of them and got no errors in the camera GUI.

auanasgheps commented 2 months ago

Additional info: I can always replicate these errors when I attempt to make changes to the Camera settings from HA Device page.

roleoroleo commented 2 months ago

Please try to disable:

MQTT Advertise settings section: Home Assistant: enabled

If you use this integration, you don't need mqtt advertising. Then remove the cam from mqtt section in ha and check if the error disappears.

auanasgheps commented 2 months ago

So I disabled the Home Assistant option in MQTT Advertising, removed the camera entry from MQTT in Home Assistant, rebooted. These errors have disappeared. I only lost the option to set the camera preset position, but I don't think it ever worked.

I think I'm good to go, thank you!

roleoroleo commented 2 months ago

I only lost the option to set the camera preset position, but I don't think it ever worked.

I don't know if it worked through mqtt. If you want to set the presets, you can use the webgui or the onvif protocol.