I've bought some Shelly V1 devices and flashed them with ESPEasy.
But i have some trouble, to get that work as i need:
First at all, i've connected a Switch (not a push button) on GPIO 5. The Switch should toggle the Relay which is connected at GPIO 4.
So GPIO 5 can be high or low which is not directly the same state on GPIO 4, because i also want to change the relay remote via FHEM .
I spent some times into the rules engine end now i have that, which doesn't do the job very well.
Problems so far with this rule:
If i boot the esp, GPIO 5 can be high or low, and if it is high it will trigger
Code: Select all
Button#Switch
This is not really what i want that lights are switched on, after a power loss.
I've configured a switch device as task #1, attatched to GPIO 5
I've configured a dummy decice as task #2 which should represent the state of the relay.
This doesn't work at all as i expect.
Code: Select all
on System#Boot do
monitor,GPIO,4
TaskValueSet 2,1,0
TaskValueSet 1,1,0
endon
on Button#Switch do
gpiotoggle,4
TaskValueSet 2,1,[Button#Switch]
endon
on toggleRelay do
gpiotoggle,4
if [Button#Switch]=0
TaskValueSet 1,1,1
else
TaskValueSet 1,1,0
endon
on GPIO,4 do
TaskValueSet 2,1,%eventvalue%
endon
Code: Select all
{"System":{
"Build":20103,
"Git Build":"mega-20190216",
"System libraries":"ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 PUYA support",
"Plugins":46,
"Plugin description":" [Normal]",
"Local time":"2019-03-03 15:12:29",
"Unit":3,
"Name":"ESP_ShellyV1_2",
"Uptime":33,
"Last boot cause":"Manual reboot",
"Reset Reason":"Software/System restart",
"Load":14.80,
"Load LC":8238,
"Free RAM":17800
},
"WiFi":{
"Hostname":"ESP-ShellyV1-2-3",
"IP config":"DHCP",
"IP":"10.2.11.58",
"Subnet Mask":"255.255.255.0",
"Gateway IP":"10.2.11.1",
"MAC address":"BC:DD:C2:94:17:BE",
"DNS 1":"10.2.11.1",
"DNS 2":"0.0.0.0",
"SSID":"xxxx",
"BSSID":"44:4E:6D:3B:10:8C",
"Channel":11,
"Connected msec":1967321,
"Last Disconnect Reason":1,
"Last Disconnect Reason str":"(1) Unspecified",
"Number reconnects":0,
"RSSI":-59
},
"Sensors":[
{
"TaskValues": [
{"ValueNumber":1,
"Name":"Switch",
"NrDecimals":0,
"Value":0
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":0,
"Type":"Switch input - Switch",
"TaskName":"Button",
"TaskEnabled":"true",
"TaskNumber":1
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"State",
"NrDecimals":0,
"Value":1
},
{"ValueNumber":2,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":3,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":4,
"Name":"",
"NrDecimals":2,
"Value":0.00
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":60,
"Type":"Generic - Dummy Device",
"TaskName":"Relay",
"TaskEnabled":"true",
"TaskNumber":2
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"uptime",
"NrDecimals":0,
"Value":30
},
{"ValueNumber":2,
"Name":"rssi",
"NrDecimals":2,
"Value":-58.00
},
{"ValueNumber":3,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":4,
"Name":"",
"NrDecimals":2,
"Value":0.00
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":600,
"Type":"Generic - System Info",
"TaskName":"SWITCH",
"TaskEnabled":"true",
"TaskNumber":3
}
],
"TTL":60000
}

May i'm on a complete wrong way how to solve my requiremens which are:
I want to be able to toggle locally (this works)
I want to be able to togge remote (this also works)
I want to be able to send a on or off comand from remote (currently this does not work)
I want to have the current state reported in a value which is reported to FHEM. (currently this does not work all the time)
Some hint's how to do that whould be nice.
Sidey