You are completely right if you think that I’m missing many concepts.
I stopped programming about 25 years ago (C++) and I just started to read and write some code last april after buying a RPI3B+ and installin Hassio, so I’m missin maaaaaany things.
But, and forgive me if I don’t understand, why the cube was working before if the old instruction was
The sensor configuration you just posted appears to be correct. If you cannot make the sensor change state then it’s due to an error in the testing procedure.
I wish I had more time to explain the fundamentals to you but, unfortunately, I do not. I suggest you review the documentation, starting here:
Sorry, and thanks for the help you gave me until now.
Making and error in copy-paste “{‘RfReceived’:{‘Data’:‘33150A’}}” in MQTT section and clicking “publish” is quite hard, but probably I did it anyway.
If you’re using that utility to publish the payload, the payload’s format is like I first suggested to you:
{"RfReceived":{"Data":"33150A"}}
or even this:
{'RfReceived':{'Data':'33150A'}}
You’ll notice they do not have leading and trailing double-quotes (") because that version was exclusively for use with the payload option of the automation you had created.
Ok, after going home, rechecking everything, trying to understand how json works and spending the evening on this… I fixed many little mistakes and now sensors are working.
I’m still having “No matching payload found for entity” warnings and “Error parsing value: ‘value_json’ is undefined” errors, but I will look into it.
Thank you for stimulating me and for pointing me in the right direction.
Mmm… I try to report here the error.
For every sensor I get:
No matching payload found for entity: Pir_Digoo_2 with state topic: tele/Sonoff_RF_Bridge/RESULT. Payload: 33150E, with value template Template("{% if value_json.RfReceived.Data == '1CC3A6' %} {{'ON'}} {% else %} {{states('binary_sensor.pir_digoo_2') | upper}} {% endif %}")
8:05 components/mqtt/binary_sensor.py (WARNING)
Error parsing value: 'value_json' is undefined (value: 33150E, template: {% if value_json.RfReceived.Data == '1CC3A6' %} {{'ON'}} {% else %} {{states('binary_sensor.pir_digoo_2') | upper}} {% endif %})
8:05 helpers/template.py (ERROR)
This happens both for sensor with only open state and sensors with open & close state.
If the payload received matches the one specified, the sensor works.
But if it doesn’t match, it doesn’t use the current sensor state, and the warning “no matching payload found” pops up again
Yes, and believe me if I say that, even if I know that my knowledge is quite poor, I try to understand before asking.
If there’s something else that I can try or check…
You’ve shown me a valid binary_sensor configuration.
You’ve shown me an error message indicating value_json is undefined.
That’s 1 + 1 = 0. It makes no sense so the only logical conclusion is that either the payload, configuration, or the testing procedure is incorrect.
FWIW, I just finished helping someone else facing the same situation and the solution I offered, which is the same one used here, worked on the first try. I realize that’s cold comfort to you but the point is that, in your situation, there may be something happening that has not been revealed yet; there’s a missing clue somewhere.
I came back home, hacs had an update, so I installed it and rebooted.
After that, I checked logs, clean.
I activated some sensors, clean.
I activated the sensor that on close gives 33150E payload. Clean, no errors or warnings in logs.
At 20:13 my girlfriend opened the garage door… each sensor showed error about payload 33150E again.
So I switched on the PC and using notepad++ I did a search in all yaml files and… I found an automation that was publishing that payload on garage door opening, NOT in JSON format (but that was working before applying you fix because of the payload_on value).
Yes, I know, I left trash around after some test…
So this should have been the last one, I didn’t try yet, but I’m quite sure that now it will be ok.