GithubHelp home page GithubHelp logo

mliljedahl / telldus-core-mqtt Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 4.0 107 KB

telldus-core-mqtt is a MQTT broker for telldus-core to integrate with Home Assistant using their MQTT Discovery.

License: Apache License 2.0

Dockerfile 4.23% Python 95.77%
telldus-core tellstick mqtt-broker dockerfile home-assistant

telldus-core-mqtt's People

Contributors

dalomstornado avatar mliljedahl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

telldus-core-mqtt's Issues

Dimmers not added as lights

My dimmers are of model = "selflearning-dimmer". Same config (parameters house and unit) as model codeswitch which work fine and added as switch.

  • Dimmers work fine execing in the container and using tdtool.
  • They do no add as lights in HA.
  • They are added as binary sensors in HA.

Any misshaps on my side perhaps?

Intergration to Home Assistant

Provide a working telldusmq.json and if needed, changes to the code to get the Home Assistant MQTT auto discovery to work,

Home Assistant fails to read temperature / support more sensor types

Thank you for this tool!

Initially I posted my problem here, but I'm moving it here:

I have installed this tool in a virtual environment, and the MQTT integration in Home Assistant (HA) correctly identifies lots of sensors from it, however, it fails to read eg. temperature and humidity:

2023-10-13 20:48:47.316 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor 167_telldus temperature, sending update
2023-10-13 20:48:47.320 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor 167_telldus humidity, sending update
2023-10-13 20:49:04.245 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor 136_telldus temperature, sending update
2023-10-13 20:49:18.333 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor 199_telldus temperature, sending update
2023-10-13 20:49:18.376 ERROR (MainThread) [homeassistant.components.mqtt.models] Exception raised when updating state of sensor.199_temperaturehumidity_telldus_199_temperature, topic: 'telldus/199/temperature/state' with payload: b'{"temperature": "15.5"}'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '{"temperature": "15.5"}'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 305, in process_write_state_requests
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 595, in state
    raise ValueError(
ValueError: Sensor sensor.199_temperaturehumidity_telldus_199_temperature has device class 'temperature', state class 'None' unit '°C' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '{"temperature": "15.5"}' (<class 'str'>)

The problem seems to be that the payload is the full string: {"temperature": "15.5"}, not just the number.

$ mosquitto_sub -h 192.168.1.2  -F '@Y-@m-@dT@H:@M:@S@z : %I : %t %p '  -t telldus/\#
2023-10-13T20:49:23+0200 : 2023-10-13T20:49:23+0200 : telldus/1/switch/state {"switch": 2} 
2023-10-13T20:49:23+0200 : 2023-10-13T20:49:23+0200 : telldus/151/temperature/state {"temperature": "8.5"} 
2023-10-13T20:49:23+0200 : 2023-10-13T20:49:23+0200 : telldus/199/temperature/state {"temperature": "15.5"} 
2023-10-13T20:49:23+0200 : 2023-10-13T20:49:23+0200 : telldus/199/humidity/state {"humidity": "58"} 
2023-10-13T20:49:23+0200 : 2023-10-13T20:49:23+0200 : telldus/167/temperature/state {"temperature": "12.3"} 

telldus-core-mqtt sends the following:

2023-10-14 09:02:56,027 60 INFO: Send "{"temperature": "20.3"}" to topic "telldus/247/temperature/state"

So, I guess that what we need to do is to identify temperature sensors and craft the payload a bit differently?

Dockerbuild

This is probably not an issue, most likely just me don't understand.

When I run docker build - < Dockerfile

I get ERROR 14/14, COPY supervisord.conf /etc/supervisord.conf

MQTT command for lights

The one that got spit out in the logs and to Home Assistant can't be right. tdtool works fine though .. it's the MQTT interpreter I need to get right.

Implement in HACS

Hi

Would be great if you could implement this in HACS, as for us newbies, this is just a tiny bit too advanced and "scary" to tinker with 🤔

mqtt_reconnect

Hi !

If I restart the mosquitto server, i have to restart the container to control my devices again .

docker-compose file

Provide a working docker-compose.yml file to get everything up and running.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.