quazzie / tellstick-plugin-mqtt-hass

Plugin for tellstick, connect to homeassistant via mqtt with autodiscovery.
36 stars 7 forks source link

Does not update available status to online #11

Closed fredrike closed 4 years ago

fredrike commented 4 years ago

For some reason the telldus publish telldus/telldus/available offline and don't seem to update to online.

My telldus is apparently available (as it publish data on MQTT)..

telldus/telldus/available offline
telldus/telldus/debug {"scale": 2, "battery": null, "valueType": 256, "value": 0.0, "deviceId": 2, "type": "sensorValueUpdated"}
telldus/telldus/debug sensorState {'scale': 2, 'lastUpdated': 1584094573, 'value': '0.0'}
telldus/telldus/debug {"scale": 2, "battery": null, "valueType": 256, "value": 0.0, "deviceId": 1, "type": "sensorValueUpdated"}
telldus/telldus/debug sensorState {'scale': 2, 'lastUpdated': 1584094574, 'value': '0.0'}
telldus/telldus/debug {"scale": 0, "battery": 254, "valueType": 1, "value": 6.5, "deviceId": 11, "type": "sensorValueUpdated"}
telldus/telldus/debug sensorState {'scale': 0, 'lastUpdated': 1584094577, 'value': '6.5'}
telldus/telldus/debug {"protocol": "fineoffset", "id": 255, "values": [{"scale": 0, "type": 1, "value": 6.5}], "model": "temperature", "data": 68455366565, "class": "sensor"}
telldus/telldus/debug {"scale": 0, "battery": 254, "valueType": 1, "value": 8.6999999999999993, "deviceId": 121, "type": "sensorValueUpdated"}
telldus/telldus/debug sensorState {'scale': 0, 'lastUpdated': 1584094578, 'value': '8.7'}
telldus/telldus/debug {"protocol": "fineoffset", "id": 199, "values": [{"scale": 0, "type": 1, "value": 8.6999999999999993}, {"scale": 0, "type": 2, "value": 66}], "model": "temperaturehumidity", "data": 328302281419, "class": "sensor"}

Originally posted by @fredrike in https://github.com/quazzie/tellstick-plugin-mqtt-hass/issues/9#issuecomment-598650462

fredrike commented 4 years ago

Pushing a online state makes it work again.

mosquitto_pub -t telldus/telldus/available -r -m "online"

Edit:

Sensors & states status works but not changing switches. I would guess that onConnect isn't fired correctly: https://github.com/quazzie/tellstick-plugin-mqtt-hass/blob/8b3d33af29b7b3a8a0d242048f04d6ad758d9c19/hass_client/Client.py#L633

quazzie commented 4 years ago

Uhm, this is so strange. Works as intended here, onConnect gets called on reconnect and available set to online. Killed the connection several times and available get set to offline, then everytime it reconnects it calls onConnect and sets available to online again. I'll try to debug some more and see what i can find.

fredrike commented 4 years ago

It actually might be some incompatibilities between my mqtt-server ..

I'm running https://hub.docker.com/_/eclipse-mosquitto with this configuration, perhaps it is something that causes issues..

password_file /mosquitto/config/passwd_file
allow_anonymous false
persistence true
persistence_file mosquitto.db
persistence_location /mosquitto/data/
autosave_on_changes true
fredrike commented 4 years ago

It is definitely my mosquitto server that is acting weird. How have you configured your mqtt server and which are you running?

uphillbattle commented 4 years ago

For what it's worth: I'm running the (Eclipse) Mosquitto broker offered as an official add-on to hass.io (running all of it in Docker on an Intel NUC). I have not noticed any problems with the mqtt server.

My configuration of the Mosquitto broker add-on is:

logins:
  - username: <username>
    password: <password>
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
quazzie commented 4 years ago

I run mosquitto in my host system. apt get mosquitto, default config.

fredrike commented 4 years ago

Cool!

I installed the https://github.com/home-assistant/hassio-addons/tree/master/mosquitto addon and it seems to be running much more stable now.

So, there is an issue with the configuration I had and the official libraries..

fredrike commented 4 years ago

I still have the same behavior.

Restarted my mqtt broker and the devices came alive again..

quazzie commented 4 years ago

I still have not found anything. You got any new info ?

fredrike commented 4 years ago

It is on my mqtt side so will close this..