A suggestion please

I have developed a small network of (kinda-lora) nrf24l01 with mqtt endpoint working, but sometimes (3%-5%) the packet is lost.

Everything works fine, graph would be better using bezier curves, instead of lineal, but great anyways. Now it’s my turn to implement thermostat. So i need a reliable way to get SURE the heater turns on/off, despite of possible packet loss.


The idea/question/target is: An automation that calls a command (turn on/off heater) every X minutes depending on a hass thermostat value.

So, THANKS !!!

Keep up the great work ppl.

might sound silly but if you’re using MQTT, up the QoS level?

The mqtt is meant to expose received values, the output to antenna is via shell command (at the moment)

so shell command to send the command/request and MQTT to confirm state?
Guess create a loop that sends the command, waits for [say] 1 sec and reads the MQTT state, and if state is wrong, run again?

Not a bad idea… Easy and interesting.

But it has a downside: If the receiver if out of service for a few minutes it will fail.

The idea is a X minutes cycle sending the command, and maybe stop the cycle when mqtt value changes. And of course, the command must be different depending on a thermostat. And to handle everything via Hass.

So your idea can be useful, but ¿can be improved? and ¿can we do it via Hass?

Thanks

yes though if it’s offline you can then add a clause in your loop to notify you of such a failure and break/exit the loop?

It should work, not so neat, but should work.

When the communication is good the mqtt is set.

¿What about using?:

1- Thermostat
2- MQTT Binary Sensor (read remote state)
3- Automation/s

Pseudocode-like condition for automation:

automation:
  -alias: 'refrescar_temperatura1'
    trigger:
      platform: time
      minutes: '/2'
      seconds: 00
	- condition: template
        value_template: (if thermostat.status is 'on') and (mqttBINsensor.state is 'off')
    action:
      service: shell_command.do_something_cool

Template is wrong, i know, but is the general idea factible?

Thanks.

1 Like

sounds ok, but what is the status of the mqttBINsensor if there is no connection? Is i still off?
Have you set the availability topic to track whether your mqtt device is online or not? That could be something to use?
your value_template should be:

	- condition: template
        value_template: {{ is_state('thermostat.status', 'on') and is_state('mqttBINsensor.state', 'off') }}
1 Like

:heart_eyes::heart_eyes:

Thanks, will code everything this weekend.