DewGew / DZGA-Flask

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

Devices offline after update to 24.8 #101

Closed Xenomes closed 4 months ago

Xenomes commented 4 months ago

After updating to 24.8, the devices in the Google Home account are offline. I have removed and re-added the devices in Google Home, and the dzga-flask page loads fine. However, the devices are still offline. There are no errors in the log, and the Smart-home-key.json is loaded.

DewGew commented 4 months ago

Any errors if you run manually?

Xenomes commented 4 months ago

When running manual i got a error message. I am om Ubuntu 20.04.6 LTS with Python 3.8.10.

Traceback (most recent call last):
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/werkzeug/middleware/proxy_fix.py", line 182, in __call__
    return self.app(environ, start_response)
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 2193, in wsgi_app
    response = self.handle_exception(e)
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/DZGA-Flask/env/lib/python3.8/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/pi/DZGA-Flask/smarthome.py", line 304, in fulfillment
    query = smarthome.query(user_id, i['payload'], requestId)
  File "/home/pi/DZGA-Flask/modules/intents.py", line 59, in query
    devices[device['id']] = trait.query(custom_data, attr, user_id)
  File "/home/pi/DZGA-Flask/modules/trait.py", line 143, in query
    response['descriptiveCapacityRemaining'] = descriptive_capacity_remaining
UnboundLocalError: local variable 'descriptive_capacity_remaining' referenced before assignment
Xenomes commented 4 months ago

I did some small tests, in docker i got the same error. Went back to commit 71c353497be3607652557aced80c3a30685043fd removed admin_devices.json my live system is up. In the test environment when using the Google Home app results in the same error message. Last one working 1e416a25d8da0bafd28f398b7228ca26f3bc3496 first error on 05a489d3e70e2315b62c79df0e6af1b3ebb22625

DewGew commented 4 months ago

It has something to do with battery level report. energyreport trait. I will check the code.

DewGew commented 4 months ago

Do you know if it happens to a specific device?

Xenomes commented 4 months ago

Not yet, i was just try to add a logger to see the idx of the device, i got 62 devices in the room in Domoticz.

Xenomes commented 4 months ago

I have detected the device. it is a Light with Tasmota firmware on it. I see the problem, It are 240V devices but in Domoticz battery is show with 200%.

Xenomes commented 4 months ago

Now i found what the problem was the fix was easy.. https://github.com/DewGew/DZGA-Flask/pull/102

DewGew commented 4 months ago

Hopefully V24.9 is working!

Xenomes commented 4 months ago

The devices are now online, but there is still an issue: when attempting to turn off a specific room, only one device reacted and reported back. I will investigate further later today to identify the problem, gather evidence, and create a new issue for it.

rhuijben commented 2 months ago

I have this last problem as well (see other issue), and found some other reports of this issue in other channels.