MQTT State

Hi

I have new boiler switch module flash with tasmota that work ok with regular on off command from OH
I want to set up 2 or more switch with count down timer using tasmota rules with timer rules and that also work fine
My problem is that I cant get back the count down timer value or the result for the rule command
what I missing?

this is my thing:

Thing mqtt:topic:boiler “Boiler” (mqtt:broker:MosquittoMqttBroker) {
Channels:
Type switch : power “Power Switch” [
commandTopic=“cmnd/boiler/POWER”,
stateTopic=“stat/boiler/POWER”,
on=“ON”,
off=“OFF”
]

	Type string : Boiler_Rule1 [
		commandTopic="cmnd/boiler/RULE1",
		stateTopic="stat/boiler/RULE1"
	]

	Type string : Boiler_RuleTimer1_State [
		commandTopic="cmnd/boiler/RULETIMER",
		stateTopic="stat/boiler/RULETIMER"
	]

}

Item:

Switch boiler “Boiler” { channel=“mqtt:topic:boiler:power” }
String strBoiler_Rule1 {channel=“mqtt:topic:boiler:Boiler_Rule1”}
String strBoilerRuleTimerState {channel=“mqtt:topic:boiler:Boiler_RuleTimer1_State”}

Rule:

rule “Test Boiler send rule”
when
Item Boiler_test changed
then
if(Boiler_test.state==ON)
{
strBoiler_Rule1.sendCommand(“ON Power1#state=1 DO RuleTimer1 10 ENDON ON Rules#Timer=1 do Power1 off ENDON”)
}

end

You might need another rule to publish your timer time to mqtt.

Do you want to be able to set the value of the timer in openHAB or just a set value

The device is manage the timer and have the values
How can I get the value from the device?

What specifically do you want? The time remaining on your countdown, or just the initial countdown time?

Do I understand correctly that you automatically want to switch off your boiler 10 seconds after it was switched on?

I’d be surprised if you could access the remaining time at all, and think you’d only be able to access the initial time if it was defined as a variable within Tasmota (but then, you’re using openHAB to send the initial time anyway…)

To get the result for the rule command, you need to subscribe to the stat/boiler/RESULT topic.

The remaining time

I want to switch off the boiler after 60 and 90 minute with 2 different switch, the 10 second is only for testing

On tasmota console I cat see the countdown timer with the values (as array)

Try this but It still return the ruletimer and not the result for the rule command

Show us this - copy and paste from the console into this forum, and use code fences (three back ticks `)

```

like this

```

Again, show us in-between code fences.

```

2020-12-19 10:24:22.431 [vent.ItemStateChangedEvent] - Boiler_test changed from OFF to ON

2020-12-19 10:24:22.806 [ome.event.ItemCommandEvent] - Item 'strBoiler_Rule1' received command ON Power1#state=1 DO RuleTimer1 10 ENDON ON Rules#Timer=1 do Power1 off ENDON

2020-12-19 10:24:22.815 [nt.ItemStatePredictedEvent] - strBoiler_Rule1 predicted to become {"T1":0,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}

```

10:00:54 MQT: stat/boiler/RESULT = {"T1":94,"T2":0,"T3":0,"T4":0,"T5":0,"T6":0,"T7":0,"T8":0}

This is what you want, isn’t it? Looks like T1 is your remaining time?

You just need to update one of your existing things, or make a new string or number thing, with stateTopic="stat/boiler/RESULT" and transformationPattern="JSONPATH:$.T1"

Did you send the ruletimer command yourself on the console? If so, you’ll have to constantly send that command to have an up to date time.

For the return result, what do you plan to do with it? Just sending Rule1 will return info on stat/boiler/RESULT

When I update one thing to the RESULT I receiving with that thing all the result and not only the timer result
Is there a way to send mqtt command like I can do in the console?

Yes, though this isn’t usually a problem - just WARN noise in the logs. However, you can filter the incoming message using REGEX. Install the REGEX Transformation Service, then try something like

transformationPattern="REGEX:(.*T1.*)∩JSONPATH:$.T1"

Try sending an empty message to cmnd/boiler/ruletimer. You could use a rule action.

If you want tasmota to spit up the MQTT topic a little better use setoption4