Hardware: Rasperry Pi 3
OS: Noobs
openjdk version “1.8.0_212”
Issue of the topic:
Hello again!
I want to use my Sonoff state as an external trigger to control another device, a Zigbee shader from Orvibo, that uses the app named Homenate. Basically, I want to have 2 switches wireless switches that control my shader through Webhooks and IFTTT. Sorry if I didn’t make myself clear so far.
I am running into some troubles and I can’t see where is my mistake. First of all I made my sonoff switch to work, I can see the state and also can publish commands. The problem is when I add a group to my item file, it doesn’t recognize my items anymore My files: ifttt_trigger.rules
rule "Send IFTTT Notification for Sonoff in Specific Group"
when
// Assign all sensor that will require notification together in one gorup
Item gTrigger_Notification received update
then
// IFTTT parameters
var String ifttt_key = "ihHjhXgJH7LkBYffXr0-UhnM_O7EVdxuR7C3UoBKC_g"
var String ifttt_event = "Sonoff_Trigger"
var String ifttt_url = "https://maker.ifttt.com/trigger/" + ifttt_event + "/with/key/" + ifttt_key
var String notification_json
// Get the last item that was updated
var lastItem = gTrigger_Notification.members.sortBy[lastUpdate].last
// Avoid sending the alert if the state didn't change
// Compare state before update and now
var lastState = lastItem.historicState(lastItem.lastUpdate.toDateTime.minusSeconds(1))
//Check if last state is different than the current state. Zwave sensors send status reports on predefined intervals. This will trigger lastUpdate filed regard$
if (lastState.state != lastItem.state) {
notification_json = '{"value1":"' + lastItem.name + '","value2":"' + lastItem.state + '"}'
sendHttpPostRequest(ifttt_url, "application/json", notification_json)
logInfo("IFTT", "IFTTT: ALARM - " + lastItem.name + " changed state from: " + lastState.state + " to: " + lastItem.state)
}
else {
// State didn't changed, supress the notification
logInfo("IFFT", "IFFT: SUPPRESED - " + lastItem.name + " changed state from: " + lastState.state + " to: " + lastItem.state)
}
end
sitemap home label="Sonoff Switches" //creez o casa numita Sonoff Switches
{
Frame label="Camera test" //creez camera test
{
Switch item=Sonoff1 //adaug un item in camera test
//itemele trebuie create in fisierul .item
Text item=State1sonoff
Text item=Sonoff-basic-1
}
}
rrd4j.persist
Strategies {
// for rrd charts, we need a cron strategy
everyMinute : "0 * * * * ?"
}
Items {
gTrigger_Notification* : strategy = everyUpdate, everyMinute, restoreOnStartup
}