I am trying to get a handle on rules and as a semi literate programmer, I decided to lean on IFTTT while I work out some of the finer points.
I decided to write a recipe in IFTTT to turn a light on at sunset. Initial testing with recipies was working using the SMS as a trigger. So I set up the following:
Is there any tutorial on how to use IFTTT on OpenHAB?
If not, I am guessing that the commands I put in “Command to Send” are much like the actions for sendCommand that are used in rules writing. Is there a comprehensive list of what commands I can used for sendCommand? I am specifically looking for a way to set the dimmer level
As always, thank you for your time. This is a great community
I just double checked my IFTTT setup and it is the same. I just have ON as the command to send, and it works fine. Since the item is populating in the drop down box I guess you have the persistence setup correctly too…when you log into my.openhab.org does it show correctly there? As for setting the dimmer level it should just be “0” - “100” to set the percentage.
Have you looked at the astro binding for this specific need? It would keep the processing on your server rather than using a cloud based trigger and it is really easy to setup.
Mine is set up the same and working. The only difference i noted was that i do not have underscores in my item name ( i use camel case). Maybe try an item without the underscores?
Thank you for the response. I think the issue may have been with Notepad++ causing some issues. I really like this software, I just wish there was more reference material. I am technical, but my linux and programming skills are juvenile at best.
I haven’t, but I am now. Thank you. But now I have questions.
openhab.cfg
astro:interval=nnn
If I set this to 86400 then the property I care about “Switch Sunrise_Event {astro=“planet=sun, type=rise, property=start”}” will be update with the proper time once per day. Correct?
I will play around with the rules after sunset and see if my theory for the IFTTT issues was in fact invalid characters in my items and sitemap.
The refresh interval is for calculating where the sun is in the sky, mostly to use in conjunction with roller shutters. I have it disabled on my setup and it works fine.
rule “Sunset”
when
Item Sunset_Event received update
then
postUpdate(Sun, OFF)
end
rule “Sunrise”
when
Item Sunrise_Event received update
then
postUpdate(Sun, ON)
end
The DateTime items will give you the actual time and the Event switches toggle on (then right back off) at sunrise/sunset (+/- the offset). The rules update the item Sun based on these updates.
IFTT works fine now as it was infact an issue with my files getting munged by Notepad++
But thanks to @MichaelWatson and am using Astro and rules successfully
For the benefit of others, here are my new rules:
rule "Lights on!"
when
Item Sunset_Event received update ON
then
sendCommand(Light_MB_Dimmer, 10)
sendCommand(Light_LR_Dimmer, 100)
end
rule "Lights off!"
when
Item Sunrise_Event received update ON
then
sendCommand(Light_MB_Dimmer, 0)
sendCommand(Light_LR_Dimmer, 0)
end
Notepad++ can cause problems when you use a Windows computer to edit files on a Unix system. Notepad++ can use diffrent linebreaks. Is needs to be used by Openhab running on a Unix system it needs to be switched to Unix/OSX format.
In Notepad++ menu ‘edit’ -> ‘EOL Conversion’ -> ‘UNIX/OSX Format’. Save the file and it should be accepted by OH
My problem is the virtual switch I’ve created in the .items file is not appearing in the IFTTT item list. I’ve exposed it in the openHAB Cloud service along with other items exposed. (those other items do appear in the IFTTT item list).
My .items file contains this:
Switch AlarmClock_switch "Alarm Clock" <switch>
Is this a known issue? Else, please advise on how to make this item visible in IFTTT. Thanks.
Did you manage to set up a virtual switch? i am trying to make a virtual switch on openhab and link it to IFTTT to turn on a generic Chinese smart socket with IFTTT support but no openhab binding?
As of a couple of weeks ago I noticed it magically appeared in IFTTT, possibly due to a code change somewhere on the cloud component (my guess).
Regarding your problem, @jsn, there is no binding for IFTTT. What you have to do is first install the Cloud Connector in the Paper UI under Addons, Misc., and set it up appropriately. Next, ensure the ["Switchable"] tag is defined as in my example above. Lastly, within IFTTT, connect to the OpenHAB service. You should then see your tagged item.