Using FHEM to call Arduino Ethernet in HTTP

Begonnen von Trancept, 13 Mai 2013, 16:31:43

Vorheriges Thema - Nächstes Thema

Trancept

Hello,

I use an home made automation project to control an heating system, the shutter and an DIY alarm.
It is base on two Arduino Ethernet and an ARM computer : a Mele A1000 based on Allwinner A10 running Ubuntu/Linaro.
The computer run Python script an PHP page to call the Arduino by HTTP, with simple URL like :
http://192.168.0.1/SHUTTER_UP
http://192.168.0.1/SHUTTER_DOWN
It all works fine but I'd like to switch to a more powerfull and generic solution. So I look at FHEM ;-)

Here come my questions : How to easily swith to FHEM ? Is it possible to configure a device who can handle on/off command and call my URL ? Or do I have to code a new device ? I could also change the Arduino code to understand an existing protocole in JSON for example. But I am not familiar with existing device in FHEM.
Firmata is not an answer for me because I want to keep intelligence in Arduino.

I first thought it would be simple but I spent time searching arround the internet an don't find the solution.

Thank's in advance for your help.

Sorry for my bad english, I'm french.

rudolfkoenig

Hello Trancept,

AFAIK there is no "finished" module which can handle this task, but it is not too difficult to build something which could do what you wish:

define shutter dummy
attr shutter setList up down
attr shutter webCmd  up:down
attr shutter devStateIcon up:shutter_1:down down:shutter_closed:up
define shutterNtfy notify shutter {GetFileFromURL "http://192.168.0.1/SHUTTER_".uc($EVENT)}

I recommend to look up the meaning of the single commands/attributes in commandref.html if you wish to extend them.

Regards,
  Rudi

Trancept

Thank you very much, it works like a charm !

Here is my code :
define voletSalonBaie dummy
attr voletSalonBaie comment Volet de la baie vitrée du salon
attr voletSalonBaie room Salon
attr voletSalonBaie setList MONTER DESCENDRE
attr voletSalonBaie webCmd MONTER:DESCENDRE
attr voletSalonBaie devStateIcon MONTER:shutter_1:DESCENDRE DESCENDRE:shutter_closed:MONTER
define shutterNtfy notify voletSalonBaie {GetFileFromURL "http://192.168.1.200/VOLET_BAIE_".uc($EVENT)}
define voletSalonBaieMonte at *07:40:00 set voletSalonBaie MONTER
define avoletSalonBaieDescend at *{sunset("REAL")} set voletSalonBaie DESCENDRE