galadril / Domoticz-Yi-Hack-Plugin

A plugin for Yi Cameras that have a Yi Hack firmware installed (MStar or AllWinner)
MIT License
3 stars 0 forks source link

Yi Hack Plugin for Domoticz does not work correctly in version 0.2.6 of Yi Hack Allwinner V2 #2

Open cvc90 opened 1 year ago

cvc90 commented 1 year ago

Yi Hack Plugin for Domoticz does not work correctly in version 0.2.6 of Yi Hack Allwinner V2 (https://github.com/roleoroleo/yi-hack-Allwinner-v2), it seems not to load correctly the json of the setting

LOG Record

CAM: Connected successfully to: 192.168.0.XX:8080 CAM: No json payload received.

galadril commented 1 year ago

I've build this plugin against v1: https://github.com/roleoroleo/yi-hack-Allwinner

And my camera is a YI 9FUS type, which is not supported by the v2 version of yi-hack-allwinner-v2

So im open for PR's 🗡️

cvc90 commented 1 year ago

It does not seem very difficult to solve, since it simply does not seem to collect the data it receives from the json well, if you need to do any type of tests I will be happy to help you in any way possible to correct it.

galadril commented 1 year ago

true, but i don't have devices laying around with v2 installed/compatible. So it would be impossible for me to check & build.

If you like, make a fork out of this repo and try to rework the json code yourself?

galadril commented 1 year ago

Actually the first thing that it tries to do is dump the json response:

  def onMessage(self, Connection, Data):
        try:
            Response = json.loads(Data["Data"])
            DumpJSONResponseToLog(Response)

So if you dont see that part in your logs, its already failing at Response = json.loads(Data["Data"])

You can try that call yourself with a browser to see the json if you like:

1) Go to the camera dashboard website and login 2) Adjust the url so that it ends with: '/cgi-bin/get_configs.sh?conf=camera'

You should then see the json payload in your browser

galadril commented 1 year ago

? can you assist ?

cvc90 commented 1 year ago

? can you assist ?

Yes @galadril, I have accessed the route http://xxx.xxx.x.xx:8080/cgi-bin/get_configs.sh?conf=camera as you say and I can say that I load the json perfectly.

image

Comparing with the plugin created by you, I see that options are missing when reading the json, I imagine that version 1 would not give the json so many options.

cvc90 commented 1 year ago

@galadril Hi, have you been able to take a look to try to fix it?

galadril commented 1 year ago

Ok i have a quick test version on a seperate branch https://github.com/galadril/Domoticz-Yi-Hack-Plugin/blob/alwinner-v2-support

(i could not test this, aldo the json looks pretty much the same as i have, but mine json is wrapped in a "Data" : { } payload.

To install this different branch: Go in your Domoticz directory using a command line and open the plugins directory. Run the next commands: git clone --branch alwinner-v2-support https://github.com/galadril/Domoticz-Yi-Hack-Plugin.git

Restart Domoticz.

You could see in your hardware that your then running the 0.0.3 version of the plugin

cvc90 commented 1 year ago

Thank you! I just tried this new branch in Domoticz and it still shows the json error in LOG, it's put in debug mode and it doesn't show any other error in LOG either, but the switches are still off as shown in the image and don't change their state .

Screenshot LOG

image

Screenshot Switches

image

galadril commented 1 year ago

mm well thats at least a start. Did some more changes, please pull again and restart domoticz

cvc90 commented 1 year ago

Good morning! I just updated the docker to the latest version, as you can see in the attached screenshots, everything seems to be the same as in the previous version, it still does not load the json correctly and that causes the switches to not load with their current state. I have also tried in debug mode and I don't see any extra error messages.

Screenshot LOG

image

Screenshot Switches

image