DewGew / DZGA-Flask

Domoticz Google Assisting using Flask
GNU General Public License v3.0
8 stars 4 forks source link

Strange behaviour Sync #82

Closed Xavier82 closed 5 months ago

Xavier82 commented 5 months ago

Setup: In Domoticz I have created a specific user for DZGA with the name "DZGA". I have only added those devices which I want to see and want to control via DZGA. Those devices are blinds, lights, doorlocks(Inverted) and switches (on-off).

I have Ngrok installed and I have a static tunnel working. (Tested this because I can ADD the service "[test] DZGA" via Google Home and I need to login to DZGA.

I continue my setup in DZGA, all devices are visible since I selected in Domoticz only those devices I want to see.

When doing a sync devices from DZGA I still get the 404 error (https://homegraph.googleapis.com:443 "POST /v1/devices:requestSync HTTP/1.1" 404 None)

When doing a sync devices from Google Assistant then the sync goes good. In the logging of DZGA I can see the request from Google to DZGA and there is no 404 error. I can also see the results of the request.

Strange thing is that my devices.json file is altered because of the sync request. In the logging I can see: ` 024-01-31 11:00:52 generated code 2024-01-31 11:00:55 request: { "inputs": [ { "intent": "action.devices.SYNC" } ], "requestId": "NUMBER" } 2024-01-31 11:00:55 Starting new HTTP connection (1): 192.168.0.30:8084 2024-01-31 11:00:55 http://192.168.0.30:8084 "GET /json.htm?type=command&param=getdevices&plan=0&filter=all&used=true HTTP/1.1" 200 4395 2024-01-31 11:00:55 Retreiving devices from domoticz 2024-01-31 11:00:55 Devices is saved in DZGA_devices.json in config folder 2024-01-31 11:00:55 response: { "requestId": "NUMBER", "payload": { "agentUserId": "NAME", "devices": [ { "id": "Group_9", "type": "action.devices.types.SWITCH", "traits": [ "action.devices.traits.OnOff"

etc. `

2024-01-31 11:00:55 Retreiving devices from domoticz 2024-01-31 11:00:55 Devices is saved in NAME_devices.json in config folder This overwrites each time the settings I made.

I have restored my settings like they were before and I have adjusted the userrights on the file to read only (for Group, User and Others). Now I do exactly the same thing with the sync. Sync from DZGA: 404 Error Sync from Google Assistant: I don't see in the logging the entire request (only the ID), then it stops, and then I get the results (all devices). The devices.json isn't altered but devices are unavailable.

I have copied the request in json format and used the Google Home validator, there are no more errors now like I had with the doorlock(Inverted).

Abny thoughts about this?

DewGew commented 5 months ago

best is to disconnect from google home first if you change alot of devices. Then reconnect

Xavier82 commented 5 months ago

I tried that (disconnect and reconnect) for 3 or 4 times, no result.

Why does every sync overwrite all the settings which were made (like Hide and Report state)?

My blinds went down completely but DZGA shows 50%: image

Sorry to bother u with al these issues, we use DZGA a lot and are eager to get this back to work.

DewGew commented 5 months ago

Try reinstall dzga you can use the same google project

Xavier82 commented 5 months ago

Complete reinstall? Full delete? I just upgraded to version 24

DewGew commented 5 months ago

Yes reinstall total reset of dzga. Not ngrok

Xavier82 commented 5 months ago

Did complete reinstall, after that again same issue like at first start. No devices from Domoticz are being catched. I can see Domoticz version and DZGA-Flask but no devices are visible in DZGA. I created as before a new user in DZGA-Flask with name DZGA and did all settings. Saved settings. Restarted server. Sync devices, nothing happens....

Then I disable Google Assistant and I do again sync, then devices show up.

I can now see the devices again but the blinds show te same issue, they are completely closed, DZGA shows slide at 50%.

Xavier82 commented 5 months ago

ok, some issues after complete install fixed. After reinstall I completed setup again by creating new user with matching credentials. I added the smart-home-key.json file to upload directory AND to Config directory.

In Google Actions I did a save at project at Develop and then Actions. The I did save at Develop and Account linking. Then I pressed "Test".

After Test, I went do Google Home and added the project as a service [test] projectname. Project and devices are now added to Google Home, they are active and updated.

But the blinds keep showing 50%: image Devices in Domotics are from switch type "Blinds Percentage"

DewGew commented 5 months ago

Can you share json output for one of those blinds? Is all blinds the same type? Log in to domoticz then enter in a browser http://xxx.xxx.x.xx:8080/json.htm?type=command&param=getdevices&rid=IDX

Edit! I found the issue with Blinds Percentage its just graphics issue in dashboard. It still works as it should

Xavier82 commented 5 months ago

ahhh, ok nice that you found the issue. Yes they do work.

Is it possible to fix this in next release?

Xavier82 commented 5 months ago

Great and fast work, thanks!