I am trying to make the sonoff change state depending on the temperature, something very simple I presume… not for me it isnt.
This is my item
Number Temp1 "Temperature Garage [%.1f °C]" <temperature> { mqtt="<[broker:tele/sonoff-28/SENSOR:state:JSONPATH($.AM2301.Temperature)]" }
This is my rule
rule "Temperature Garage"
when
Item Temp1 changed
then
if (Temp1.state < 22) {
LED.sendCommand(ON)
Temp1.sendCommand(ON)
}
if (Temp1.state >= 22) {
LED.sendCommand(OFF)
Temp1.sendCommand(OFF)
}
end
I know the rule is working because the LED in the rule which is connected to a GPIO pin is toggling.
Just one other slight issue, it only seems to get the temperature every 5 minutes, is there am way i can get updates more often
I didn’t work with sonoff sensors yet, but it seems that your firmware is pushing those updates in a 5min intervall, so maybe there is a corresponding setting in the firmware you are using.
You are sending the ON and OFF commands to an item that is:
Of type Number (where ON/OFF have no meaning)
Not defined with an outbound binding (only inbound for the temperature updates)
I am not sure what firmware you have loaded, and how you have configured the Sonoff, but for this to work you need an item of type Switch that has an outbound binding to the correct MQTT topic.
The mqqt topics, look like he has used Tasmota.
The sonoff devices that i am using with Tasmota have a similar binding structure.
I have looked at my sonoff config and it seems you can’t configure the updating interval for sensors on the webinterface.
(But maybe it only doesnt work with the Basic Model that i have choosen in my configuration.)
Hi
After hitting “Enter” on the topic, I realised that I needed to configure the MQTT which I have now done, and can send sendCommond(ON) successfully (even though it is defined as a number). Yes its Tasmota, I will have a search around in the code to see if i can find an update setting.
TelePeriod Show current telemetry period in seconds
TelePeriod 0 / off Disable telemetry messages
TelePeriod 1 Reset telemetry period to user_config.h (TELE_PERIOD)
TelePeriod <secs> Set telemetry period between 10 and 3600 seconds