MagicHome RGB-Tasmota with Yaml Script, Log error

Can anyone help me decipher this error and any obvious solutions I’m missing…The RGB strip works fine but just errors in the log

Error doing job: Exception in callback <bound method MQTT._mqtt_handle_message of <homeassistant.components.mqtt.MQTT object at 0x7585adf0>>
Traceback (most recent call last):
File “uvloop/cbhandles.pyx”, line 66, in uvloop.loop.Handle._run
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/ init .py”, line 691, in _mqtt_handle_message
msg.topic, payload, msg.qos)
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 300, in async_run_job
target(*args)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/light/mqtt.py”, line 250, in brightness_received
device_value = float(templatesCONF_BRIGHTNESS)
ValueError: could not convert string to float:

I’m using this in my configuration.yaml to control some RGB strip using a MagicHome thats been Tasmota’d ver 6.1.1c

  - platform: mqtt
    name: "MagicHome RGB Strip"
    state_topic: "stat/MagicHome/RESULT"
    command_topic: "cmnd/MagicHome/POWER"
    state_value_template: "{{ value_json.POWER }}"
    brightness_state_topic: "stat/MagicHome/RESULT"
    brightness_command_topic: "cmnd/MagicHome/Dimmer"
    brightness_scale: 100
    brightness_value_template: "{{ value_json.Dimmer }}"
#    white_value_state_topic: "stat/MagicHome/RESULT"
#    white_value_command_topic: "cmnd/MagicHome/Channel4"
#    white_value_scale: 100
#    white_value_template: "{{ value_json.Channel[3] }}"
    rgb_command_topic: "cmnd/MagicHome/Color"
    rgb_command_template: "{{ '%02x%02x%02x' | format(red, green, blue)}}"
    rgb_state_topic: "stat/MagicHome/RESULT"
    rgb_value_template: "{{(value_json.Channel[0]*2.55)|int}},{{(value_json.Channel[1]*2.55)|int}},{{(value_json.Channel[2]*2.55)|int}}"
    effect_state_topic: "stat/MagicHome/RESULT"
    effect_command_topic: "cmnd/MagicHome/Scheme"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    retain: false
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"

this:
{{(value_json.Channel[0]*2.55)|int}},{{(value_json.Channel[1]*2.55)|int}},{{(value_json.Channel[2]*2.55)|int}}

should be something along the lines:
{{(value_json.Channel[0]|float*2.55)|int}},{{(value_json.Channel[1]|float*2.55)|int}},{{(value_json.Channel[2]|float*2.55)|int}}

you’re trying to multiply a string value_json.Channel[] with a float 2.55

I have entered the code as you suggest to eliminate the error but it’s still there unfortunately

May need to adjust this too

brightness_value_template: "{{ value_json.Dimmer }}"

Maybe try

brightness_value_template: "{{ value_json.Dimmer | float }}"

I entered that code too but that generated an additional error too

Error parsing value: 'dict object' has no attribute 'Dimmer' (value: {"POWER":"ON"}, template: {{ value_json.Dimmer | float }})

sorry I’m not sure then.
this appears to be your issue

device_value = float(templatesCONF_BRIGHTNESS)
ValueError: could not convert string to float:

So I would think it has to do with the brightness.
What if you comment out the 4 brightness lines, do you still get the error message?

So with the brightness commented out I get two errors…

Error doing job: Exception in callback <bound method MQTT._mqtt_handle_message of <homeassistant.components.mqtt.MQTT object at 0x75836130>>
Traceback (most recent call last):
  File "uvloop/cbhandles.pyx", line 66, in uvloop.loop.Handle._run
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 691, in _mqtt_handle_message
    msg.topic, payload, msg.qos)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 300, in async_run_job
    target(*args)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/mqtt.py", line 272, in rgb_received
    templates[CONF_RGB](payload).split(',')]
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/mqtt.py", line 271, in <listcomp>
    rgb = [int(val) for val in
ValueError: invalid literal for int() with base 10: '{"POWER":"OFF"}'

and

Error parsing value: 'dict object' has no attribute 'Channel' (value: {"POWER":"OFF"}, template: {{(value_json.Channel[0]|float*2.55)|int}},{{(value_json.Channel[1]|float*2.55)|int}},{{(value_json.Channel[2]|float*2.55)|int}})

This is what solved ALL of my error messages including the ones you’re getting, I just followed what was written here:

Here’s what it says that fixed it for me:

Enable SetOption4 which then provides the responses on messages other than ‘Result’.
Then just update your MQTT to match;
i.e.

 platform: mqtt
    name: "Kitchen Island Bench"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    state_topic: "stat/islandBench/POWER"
    state_value_template: "{{ value }}"
    command_topic: "cmnd/islandBench/POWER"
    brightness_state_topic: "stat/islandBench/DIMMER"
    brightness_command_topic: "cmnd/islandBench/Dimmer"
    brightness_value_template: "{{ value_json.Dimmer }}"
    brightness_scale: 100
    rgb_state_topic: "stat/islandBench/COLOR"
    rgb_command_topic: "cmnd/islandBench/Color2"
    rgb_value_template: "{{(value_json.Channel[0]*2.55)|int}},{{(value_json.Channel[1]*2.55)|int}},{{(value_json.Channel[2]*2.55)|int}}"
    effect_command_topic: "cmnd/islandBench/Scheme"
    effect_state_topic: "stat/islandBench/SCHEME"
    effect_value_template: "{{ value.Scheme }}"
    retain: true
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"_
2 Likes

That’s brilliant…Thanks for passing that on. Its fixed it perfectly !!

1 Like