My.OpenHAB and IFTTT questions and issues

my.openhab
ifttt
Tags: #<Tag:0x00007f014cbbc430> #<Tag:0x00007f014cbbc188>

(Guillermo Rodriguez) #1

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:

This rule fails to execute. so I check the log and see this:

2015-10-26 19:02:11.453 [DEBUG] [.myopenhab.internal.MyOHClient] - on(): command
2015-10-26 19:02:11.454 [DEBUG] [.myopenhab.internal.MyOHClient] - Received command ON for item Light_MB_Dimmer
2015-10-26 19:02:11.455 [WARN ] [o.o.i.m.i.MyOpenHABServiceImpl] - Received my.openHAB command for a non-existant item Light_MB_Dimmer

Here is the relevant item line:

Dimmer	Light_MB_Dimmer	"Master Room Dimmer [%d %%]"	(Master_Bedroom)		{ zwave="4:command=SWITCH_MULTILEVEL" }

Local control of this item works fine.

So on to my questions…

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


(Michael Watson) #2

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.


(tpmcleod24) #3

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?


(Guillermo Rodriguez) #4

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.


(Michael Watson) #5

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.

My setup is as follows:

Items:
DateTime Sunrise “Sunrise [%1$tH:%1$tM]” { astro=“planet=sun, type=rise, property=start” }
DateTime Sunset “Sunset [%1$tH:%1$tM]” { astro=“planet=sun, type=set, property=end” }
Switch Sun
Switch Sunset_Event “Sunset Event” { astro=“planet=sun, type=set, property=end, offset=-15” }
Switch Sunrise_Event “Sunrise Event” { astro=“planet=sun, type=civilDawn, property=start” }

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.


(Guillermo Rodriguez) #6

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

(pieter_s_top) #7

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


(Guillermo Rodriguez) #8

Thank you. I will make sure that is set as I really like using Notepad ++ for certain things.


(Sam B.) #9

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.


(Sam B.) #10

anybody?


(Jason butcher) #11

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?


(Sam B.) #12

Yes, that was the easy part.

Switch   AlarmClock_switch "Alarm Clock" <switch> [ "Switchable" ] 

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.


(Jason butcher) #13

Thanks for your help, I have got it set up now.