fmartinou / tydom2mqtt

Deltadore Tydom to MQTT Bridge
https://fmartinou.github.io/tydom2mqtt/
MIT License
86 stars 49 forks source link

Very high CPU usage #90

Open mariusjell opened 1 year ago

mariusjell commented 1 year ago

Latest addon version hogs the cpu.

Running Home Assistant OS in a VMware virtual machine on ESXi 7.0.3. Restart of the addon solves the problem for some hours. Logs are spammed with "unable to handle message".

I have only one paired Tyxia 4840 that is not supported so I've just disabled the addon.

See screenshots for details. cpu cpu2 cpu3

fmartinou commented 1 year ago

Which endoint are you using to connect to the Tydom: mediation.tydom.com or the tydom local IP address?

mariusjell commented 1 year ago

Which endoint are you using to connect to the Tydom: mediation.tydom.com or the tydom local IP address?

Local ip.

2023-03-31 10:54:09,007 - Starting tydom2mqtt
2023-03-31 10:54:09,007 - Hassio environment detected: loading configuration from /data/options.json
2023-03-31 10:54:09,007 - Validating configuration ({
    "log_level": "INFO",
    "mqtt_host": "192.168.0.104",
    "mqtt_password": 
    "mqtt_port": 1883,
    "mqtt_ssl": false,
    "mqtt_user": 
    "tydom_alarm_home_zone": 1,
    "tydom_alarm_night_zone": 2,
    "tydom_alarm_pin": "*****",
    "tydom_ip": "192.168.0.190",
    "tydom_mac": "************",
    "tydom_password": "^*************7"
}
2023-03-31 10:54:09,008 - The configuration is valid
2023-03-31 10:54:09,009 - tydom.TydomClient    - INFO    - Configure local mode (192.168.0.190)
2023-03-31 10:54:09,011 - mqtt.MqttClient      - INFO    - Connecting to mqtt broker (host=192.168.0.104, port=1883, user=mqtt, ssl=False)
2023-03-31 10:54:09,012 - tydom.TydomClient    - INFO    - Connecting to tydom
2023-03-31 10:54:10,221 - mqtt.MqttClient      - INFO    - Connected to mqtt broker
fmartinou commented 1 year ago

Can you please briefly restart the addon with LOG_LEVEL=debug to get more details? thanks

mariusjell commented 1 year ago

Can you please briefly restart the addon with LOG_LEVEL=debug to get more details? thanks

2023-03-31 10:57:17,272 - The configuration is valid
2023-03-31 10:57:17,272 - tydom.TydomClient    - DEBUG   - Initializing TydomClient Class
2023-03-31 10:57:17,272 - tydom.TydomClient    - INFO    - Configure local mode (192.168.0.190)
2023-03-31 10:57:17,274 - asyncio              - DEBUG   - Using selector: EpollSelector
2023-03-31 10:57:17,275 - mqtt.MqttClient      - INFO    - Connecting to mqtt broker (host=192.168.0.104, port=1883, user=mqtt, ssl=False)
2023-03-31 10:57:17,275 - tydom.TydomClient    - INFO    - Connecting to tydom
2023-03-31 10:57:18,527 - tydom.TydomClient    - DEBUG   - Response headers
2023-03-31 10:57:18,527 - tydom.TydomClient    - DEBUG   - Connection: close
WWW-Authenticate: Digest realm="Protected Area", qop="auth", nonce="7162756efde1f59e84c0fd0e3362c8af", opaque="47ecb390d1988cc12f83aab3c612e2e4"
Content-Type: text/html
2023-03-31 10:57:18,556 - tydom.TydomClient    - DEBUG   - Response code
2023-03-31 10:57:18,557 - tydom.TydomClient    - DEBUG   - 401
2023-03-31 10:57:18,557 - tydom.TydomClient    - DEBUG   - response
2023-03-31 10:57:18,558 - tydom.TydomClient    - DEBUG   - b'<!doctype html>\r\n<html>\r\n<head><title>Error 401</title></head>\r\n<body>\r\n<h2>Error 401</h2>\r\n<p>Authorization required</p>\r\n</body>\r\n</html>\r\n'
2023-03-31 10:57:18,558 - tydom.TydomClient    - DEBUG   - Upgrading http connection to websocket....
2023-03-31 10:57:18,558 - tydom.TydomClient    - DEBUG   - Attempting websocket connection with Tydom hub
2023-03-31 10:57:18,628 - gmqtt.mqtt.protocol  - INFO    - [CONNECTION MADE]
2023-03-31 10:57:18,629 - gmqtt.mqtt.handler   - DEBUG   - [CMD 0x20] b'\x00\x00\x06"\x00\n!\x00\x14'
2023-03-31 10:57:18,629 - gmqtt.mqtt.handler   - DEBUG   - [CONNACK] flags: 0x0, result: 0x0
2023-03-31 10:57:18,630 - mqtt.MqttClient      - DEBUG   - Subscribing to topics (+/tydom/#)
2023-03-31 10:57:18,630 - gmqtt.mqtt.utils     - DEBUG   - NEW ID: 1
2023-03-31 10:57:18,630 - gmqtt.mqtt.package   - INFO    - [SEND SUB] 1 [b'homeassistant/status']
2023-03-31 10:57:18,630 - gmqtt.mqtt.utils     - DEBUG   - NEW ID: 2
2023-03-31 10:57:18,630 - gmqtt.mqtt.package   - INFO    - [SEND SUB] 2 [b'+/tydom/#']
2023-03-31 10:57:18,630 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:18,631 - mqtt.MqttClient      - INFO    - Connected to mqtt broker
2023-03-31 10:57:18,631 - gmqtt.mqtt.handler   - DEBUG   - [CMD 0x90] b'\x00\x01\x00\x00'
2023-03-31 10:57:18,631 - gmqtt.mqtt.handler   - INFO    - [SUBACK] 1 (0,)
2023-03-31 10:57:18,631 - gmqtt.mqtt.utils     - DEBUG   - FREE MID: 1
2023-03-31 10:57:18,635 - websockets.client    - DEBUG   - = connection is CONNECTING
2023-03-31 10:57:18,672 - gmqtt.mqtt.handler   - DEBUG   - [CMD 0x90] b'\x00\x02\x00\x00'
2023-03-31 10:57:18,672 - gmqtt.mqtt.handler   - INFO    - [SUBACK] 2 (0,)
2023-03-31 10:57:18,672 - gmqtt.mqtt.utils     - DEBUG   - FREE MID: 2
2023-03-31 10:57:19,857 - websockets.client    - DEBUG   - > GET /mediation/client?mac=*******&appli=1 HTTP/1.1
2023-03-31 10:57:19,857 - websockets.client    - DEBUG   - > Host: 192.168.0.190
2023-03-31 10:57:19,857 - websockets.client    - DEBUG   - > Upgrade: websocket
2023-03-31 10:57:19,857 - websockets.client    - DEBUG   - > Connection: Upgrade
2023-03-31 10:57:19,858 - websockets.client    - DEBUG   - > Sec-WebSocket-Key: x+ZvR3ID0pXMhZCIIS6Hug==
2023-03-31 10:57:19,858 - websockets.client    - DEBUG   - > Sec-WebSocket-Version: 13
2023-03-31 10:57:19,858 - websockets.client    - DEBUG   - > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2023-03-31 10:57:19,858 - websockets.client    - DEBUG   - > Authorization: Digest username="********", realm="protected area", nonce="7162756efde1f59e84c0fd0e3362c8af", uri="/mediation/client?mac=*********&appli=1", response="6fe77d3808b2667d43298ca94bd2853b", qop="auth", nc=00000001, cnonce="daaecab17e07b213"
2023-03-31 10:57:19,858 - websockets.client    - DEBUG   - > User-Agent: Python/3.11 websockets/10.4
2023-03-31 10:57:19,869 - websockets.client    - DEBUG   - < HTTP/1.1 101 Switching Protocols
2023-03-31 10:57:19,869 - websockets.client    - DEBUG   - < Upgrade: websocket
2023-03-31 10:57:19,869 - websockets.client    - DEBUG   - < Connection: Upgrade
2023-03-31 10:57:19,869 - websockets.client    - DEBUG   - < Sec-WebSocket-Accept: c+YGBPVpIw5RKr3rhKRcQvu0R7E=
2023-03-31 10:57:19,870 - websockets.client    - DEBUG   - = connection is OPEN
2023-03-31 10:57:19,870 - tydom.TydomClient    - INFO    - Connected to tydom
2023-03-31 10:57:19,870 - tydom.TydomClient    - INFO    - Setup tydom client
2023-03-31 10:57:19,870 - tydom.TydomClient    - DEBUG   - Sending message to tydom (GET /info)
2023-03-31 10:57:19,870 - websockets.client    - DEBUG   - > BINARY 47 45 54 20 2f 69 6e 66 6f 20 48 54 54 50 2f 31 ... 64 3a 20 30 0d 0a 0d 0a [103 bytes]
2023-03-31 10:57:19,871 - tydom.TydomClient    - DEBUG   - Sending message to tydom (POST /refresh/all)
2023-03-31 10:57:19,871 - websockets.client    - DEBUG   - > BINARY 50 4f 53 54 20 2f 72 65 66 72 65 73 68 2f 61 6c ... 64 3a 20 30 0d 0a 0d 0a [111 bytes]
2023-03-31 10:57:19,871 - tydom.TydomClient    - DEBUG   - Sending message to tydom (GET /configs/file)
2023-03-31 10:57:19,871 - websockets.client    - DEBUG   - > BINARY 47 45 54 20 2f 63 6f 6e 66 69 67 73 2f 66 69 6c ... 64 3a 20 30 0d 0a 0d 0a [111 bytes]
2023-03-31 10:57:19,872 - tydom.TydomClient    - DEBUG   - Sending message to tydom (GET /devices/cmeta)
2023-03-31 10:57:19,872 - websockets.client    - DEBUG   - > BINARY 47 45 54 20 2f 64 65 76 69 63 65 73 2f 63 6d 65 ... 64 3a 20 30 0d 0a 0d 0a [112 bytes]
2023-03-31 10:57:19,872 - tydom.TydomClient    - DEBUG   - Sending message to tydom (GET /devices/data)
2023-03-31 10:57:19,872 - websockets.client    - DEBUG   - > BINARY 47 45 54 20 2f 64 65 76 69 63 65 73 2f 64 61 74 ... 64 3a 20 30 0d 0a 0d 0a [111 bytes]
2023-03-31 10:57:19,888 - websockets.client    - DEBUG   - < BINARY 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d ... 6e 2e 74 79 64 6f 6d 2e [1024 bytes, continued]
2023-03-31 10:57:19,894 - websockets.client    - DEBUG   - < CONT 'com",\r\n16\r\n"pltRegistered":false,\r\n19\r\n...\r\n1\r\n}\r\n0\r\n\r\n' [text, 788 bytes]
2023-03-31 10:57:19,895 - tydom.MessageHandler - DEBUG   - Message received detected as (msg_info)
2023-03-31 10:57:19,895 - tydom.MessageHandler - DEBUG   - Incoming data parsed with success
2023-03-31 10:57:20,043 - websockets.client    - DEBUG   - < BINARY 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d ... 64 3a 20 30 0d 0a 0d 0a [139 bytes]
2023-03-31 10:57:20,043 - websockets.client    - DEBUG   - < BINARY 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d ... 3a 22 54 4f 54 41 4c 54 [1024 bytes, continued]
2023-03-31 10:57:20,049 - websockets.client    - DEBUG   - < CONT '","id":706008290,"usage":"plug","picto":"picto_...":[],"old_tycam":false}' [text, 91 bytes]
2023-03-31 10:57:20,049 - tydom.MessageHandler - DEBUG   - Message received detected as (msg_config)
2023-03-31 10:57:20,049 - tydom.MessageHandler - DEBUG   - Configuration updated
2023-03-31 10:57:20,050 - tydom.MessageHandler - DEBUG   - Incoming data parsed with success
2023-03-31 10:57:20,061 - websockets.client    - DEBUG   - < BINARY 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d ... 0a 0d 0a 30 0d 0a 0d 0a [320 bytes]
2023-03-31 10:57:20,062 - tydom.MessageHandler - DEBUG   - Message received detected as (msg_cmetadata)
2023-03-31 10:57:20,062 - tydom.MessageHandler - DEBUG   - Metadata configuration updated
2023-03-31 10:57:20,062 - tydom.MessageHandler - DEBUG   - Incoming data parsed with success
2023-03-31 10:57:20,073 - websockets.client    - DEBUG   - < BINARY 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d ... 69 64 69 74 79 22 3a 22 [1024 bytes, continued]
2023-03-31 10:57:20,079 - websockets.client    - DEBUG   - < CONT 'upToDate","value":false}\r\n39\r\n,{"name":"cmd...n]}]}]\r\n\r\n0\r\n\r\n' [text, 302 bytes]
2023-03-31 10:57:20,079 - tydom.MessageHandler - DEBUG   - Message received detected as (msg_data)
2023-03-31 10:57:20,079 - tydom.MessageHandler - INFO    - Device update (id=1671880285, endpoint=1671880285, name=enhter ikke styrt, type=unknown)
2023-03-31 10:57:20,079 - tydom.MessageHandler - WARNING - Unknown device name (1671882893_1671882893)
2023-03-31 10:57:20,080 - tydom.MessageHandler - WARNING - Unknown device type (1671882893_1671882893)
2023-03-31 10:57:20,080 - tydom.MessageHandler - INFO    - Device update (id=1671882893, endpoint=1671882893, name=, type=)
2023-03-31 10:57:20,080 - tydom.MessageHandler - DEBUG   - Incoming data parsed with success
2023-03-31 10:57:23,642 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:28,645 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:33,652 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:38,657 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:39,871 - websockets.client    - DEBUG   - % sending keepalive ping
2023-03-31 10:57:39,871 - websockets.client    - DEBUG   - > PING 8e a5 48 59 [binary, 4 bytes]
2023-03-31 10:57:39,878 - websockets.client    - DEBUG   - < PONG '' [0 bytes]
2023-03-31 10:57:43,661 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
2023-03-31 10:57:48,661 - gmqtt.client         - DEBUG   - [QoS query IS EMPTY]
fschneider-wedge commented 1 year ago

Hi, I had same issue but after restarting my Tydom box and then HA TydomMQTT addon, It seems to work normally again.

webjib commented 1 year ago

Same issue, sometimes my covers are unresponsive. Then I notice that the add-on is using 60-70% of the CPU, and my Raspberry becomes very hot. Restarting the add-on fixes the issue, until next one.

Coldness00 commented 1 year ago

I have same issue running as Docker in synology NAS See below extract from my Grafana image

webjib commented 1 year ago

Yesterday, I’ve unplugged my Tydom Home, and immediately, the add-on started to use CPU more heavily, then my RPI becomes less responsive. Usually this issue happens every 1 or 2 days. IMG_0899

cob94440 commented 1 year ago

Hello, I have the same bug. Is it still on latest version?

Coldness00 commented 1 year ago

Hello, I noticed this happens every time I loose Internet, or if I reboot my Internet Provider Box.

brubakers commented 1 year ago

Yes i have noticed this too, it happens every time It has no internet conection but not only at that moment, in my computer, It happens every night, i have to restart the add-on every morning