i run oh2 v2.2 on a rPI3 with HM-MOD-RPI-PCB for my homematic componentes, a nanoCUL434 for my Intertechno sockets and have a lot of sonoff sockets, which all are communicating with the mosquitto on the rPI3. My homematic components communicating with homegear on the rPI3, this works fine. Then i have some homematic pushbuttons (2way, 6way) and a lot of heating controller. My Intertechno sockets are switched on and off over rules, this works fine.
But i want to switch my sonoff / Intertechno sockets with a push button. Therefore i created a simple rule:
rule "Stehlampe_An"
when
Channel 'homematic:HG-HM-PB-2-WM55:aea48cbf:LEQ0571338:1#PRESS_SHORT' triggered SHORT
then
if (MQTT_Stehlampe.state != ON)
{
sendCommand(MQTT_Stehlampe, ON)
}
else if (MQTT_Stehlampe.state != OFF)
{
sendCommand(MQTT_Stehlampe, OFF)
}
end
Change your rule to:
It may not solve the problem but it’s tidier
rule "Stehlampe_An"
when
Channel 'homematic:HG-HM-PB-2-WM55:aea48cbf:LEQ0571338:1#PRESS_SHORT' triggered SHORT
then
if (MQTT_Stehlampe.state != ON) {
sendCommand(MQTT_Stehlampe, ON)
} else {
sendCommand(MQTT_Stehlampe, OFF)
}
end
So, i’ve tunneled now my ssh session trough our companies firewall. This - maybe work:
2018-04-19 10:56:46.922 [DEBUG] [ematic.handler.HomematicThingHandler] - Received command 'OFF' for channel 'homematic:HG-HM-PB-2 M55:aea48cbf:LEQ0571338:1#PRESS_SHORT'
2018-04-19 10:56:47.187 [WARN ] [ommunicator.AbstractHomematicGateway] - Datapoint is readOnly, it is
not published to the gateway with id 'aea48cbf': 'LEQ0571338:1#PRESS_SHORT'
2018-04-19 10:56:51.080 [DEBUG] [ommunicator.AbstractHomematicGateway] - Received new (String)
value 'aea48cbf' for 'CENTRAL:0#PONG' from gateway with id 'aea48cbf'
2018-04-19 10:56:51.135 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to
cmnd/stehlampe/POWER
2018-04-19 10:56:51.130 [DEBUG] [ematic.handler.HomematicThingHandler] - Received command 'ON' for
channel 'homematic:HG-HM-PB-2-WM55:aea48cbf:LEQ0571338:1#PRESS_SHORT'
2018-04-19 10:56:51.485 [WARN ] [ommunicator.AbstractHomematicGateway] - Datapoint is readOnly, it is not published to the gateway with id 'aea48cbf': 'LEQ0571338:1#PRESS_SHORT'
2018-04-19 10:56:51.338 [DEBUG] [t.mqtt.internal.MqttBrokerConnection] - Publishing message
136 to topic 'cmnd/stehlampe/POWER'
But I can not tell if the lamp has been started or not. My webcam is not turned on today ;-( I’ll give you a feedback tonight.
Okay, I’ll take a look at the web interface of the sonoff floor lamp. His condition changes from OFF to ON … cool!
I will test it later at home if I have direct access to the switch.
Thanks once from the office
just for correctness - i’ve got it running now. This is my rule:
rule "Schlafzimmer_TA_2"
when
Channel 'homematic:HG-HM-PB-2-WM55:aea48cbf:LEQ0571338:1#PRESS' triggered SHORT
then
if (IT_Salzlampe_SZ.state != ON)
{
sendCommand(IT_Salzlampe_SZ, ON)
}
else if (IT_Salzlampe_SZ.state != OFF)
{
sendCommand(IT_Salzlampe_SZ, OFF)
}
end
One short press on the upper button toggles the lamp state from off -> on and vice versa. The lower button switches another IT socket.
You can simplify your rule a bit assuming there are only two states the lamp can be ON or OFF only
Also you need to use item method instead of the action for sendCommand
rule "Schlafzimmer_TA_2"
when
Channel 'homematic:HG-HM-PB-2-WM55:aea48cbf:LEQ0571338:1#PRESS' triggered SHORT
then
if (IT_Salzlampe_SZ.state != ON) {
IT_Salzlampe_SZ.sendCommand(ON)
} else {
IT_Salzlampe_SZ.sendCommand(OFF)
}
end