Hello,
I need help regarding the title. I am not a mjs expert and I want a script that publishes a custom mqtt topic when
Shelly Plus 2PM in cover mode, changes state or changes position.
The only thing that I managed to write, combining bits from here and there is the below scipt
Code
function startTimer() {
Timer.set(30*1000,true,function(){
Shelly.call(
"cover.getStatus",
{ id: 0 },
function (response) {
MQTT.publish("hello/world/state", JSON.stringify(response.state), 0, false);
MQTT.publish("hello/world/pos", JSON.stringify(response.current_pos), 0, false);
MQTT.publish("hello/world/temp", JSON.stringify(response.temperature.tC), 0, false);
},
null
);
}
,null);
}
startTimer();
Alles anzeigen
But of course this is not what i want. I understand I should use a statusHandler or eventHandler but I really don;t understand how to do it...
So, if anybody could help me I would appreciate it.
Thank you in advance.