Home automation gateway HE840IP

Hi,

I’ve bought a Home Easy Home automation gateway (HE840IP).
elro.eu/en/products/cat/home … on-gateway

It’s possible to controle switches connected to this hub using curl. The following two commands switches a Home Easy Plug-in switch:
(elro.eu/en/products/cat/home … -in-switch)

curl -X POST -d "
optype=singledev
&devtype=switch
&controltype=off
&devid=350
&sessid=ovRhbPkCrzSKE5Iv83t34f7tBog2bD5r0VHbLSM5lFPYCquJsXDndKHF1XHcBLuB
" -v -L 192.168.50.61/cgi-bin/devicecontrol.cgi

curl -X POST -d "
optype=singledev
&devtype=switch
&controltype=on
&devid=350
&sessid=ovRhbPkCrzSKE5Iv83t34f7tBog2bD5r0VHbLSM5lFPYCquJsXDndKHF1XHcBLuB
" -v -L 192.168.50.61/cgi-bin/devicecontrol.cgi

curl -X POST -d “UserName=admin&UserPassword=111111” -v -L 192.168.50.61/cgi-bin/uservalid.cgi

Is there a project for this component?
If so, which one and how can i help?
If not, what would be the best course of action to integrate this hub into HA. Is there a component which i could use as a starting point?

Thx
Bob

Not that I’m aware of. But to be sure the the issue tracker and the PR at github.com/balloob/home-assistant/

There is support for RESTful devices…could be a way to integrate your gateway but it’s seems that the payload is pretty extensive. I guess that the quickest way would be to use a Command line switch.

The myStrom switch platform is communicating with the device through Python Requests.

@jarod83 How did you come by these headers & url’s??

I have the same sender and i would like to get some python scripting going to be able to switch without that hideous webpage and integrate it into my home automation system…

Could you tell me more??

Hi Stokstaart,

I just opened Firefox’s F12 function to see the posts/gets the web interface makes.

Haven’t had time to get into it.

@jarod83 well thank you for initially proving it could be done!
I got some time today and managed to write some bash script with which I now can control the switches! (Using somatic so sorry for that…)
If you are interested i could post this tomorrow ( on my phone now…)

@stokstaart I have the same device. Could you share your code? Otherwise I will try and put something together myself. Thanks!

Sure, but be aware, i am in no way a programmer so the code could be incomplete (i know the dimmercode has some issues…)

For the switches you could use:

#To use give command lightswitch.sh 2972 off where 2972 is the devid for the switch!

switch=$1
type=$2
IP=$(curl -X POST -d “UserName=XXXXXXX&UserPassword=XXXXXXX” -v -L 192.168.178.106/cgi-bin/uservalid.cgi)
description=echo $IP | sed -e 's/^.*"session"[ ]*:[ ]*"//' -e 's/".*//'
curl -X POST -d “optype=singledev&devtype=switch&controltype=”$type"&devid="$switch"&sessid="$description" -v -L 192.168.178.106/cgi-bin/devicecontrol.cgi

Next for the dimmer:


#controls connected dimmer command would be ‘script.sh 10%’
action=$1 #could be ‘on’ /‘off’ / ‘40%’
if [[ $action == “%” ]] #The dimmer goes in steps of 10%, so get the first and add a ‘0’ when we dimm it…
then
action=${action::1}0;
fi
IP=$(curl -X POST -d “UserName=XXXXXXXX&UserPassword=XXXXXXXX” -v -L 192.168.178.106/cgi-bin/uservalid.cgi)
description=echo $IP | sed -e 's/^.*"session"[ ]*:[ ]*"//' -e 's/".*//'
curl -X POST -d “optype=singledev&devtype=dimmer&controltype=”$action"&devid=2194&sessid="$description" -v -L 192.168.178.106/cgi-bin/devicecontrol.cgi

Good luck and happy coding with it!!

Sorry for the late reply, but thanks a lot! Will give it a try.

[Off topic] Anyone running homebridge can try my plugin for it:

A bit late to the party, but i finally managed to create a switch.sh that works from the command line, but i have no clue how to integrate this in HA

if i run #switch.sh 1234 on it actually turn on, but i hve no clue how to continue from here, any help would be appreciated

so i think i figured things out, just posting my code here for any one that happens to need it, im runniing hassio on ubuntu server.

first i created lightswitch.sh in the config dir with the following content:

switch=$1
type=$2
IP=$(curl -X POST -d 'UserName=admin&UserPassword=11111' -v -L 192.168.1.45/cgi-bin/uservalid.cgi)
description=`echo $IP | sed -e 's/^.*"session"[ ]*:[ ]*"//' -e 's/".*//'`
curl -X POST -d 'optype=singledev&devtype=switch&controltype='$type'&devid='$switch'&sessid='$description'' -v -L 192.168.1.45/cgi-bin/devicecontrol.cgi?

then added the following to switches.yaml

- platform: command_line
  switches:
    light_livingroom:
       command_on: sh ./lightswitch.sh 1382 on
       command_off: sh ./lightswitch.sh 1382 off

where 1382 is the device id found viewing the method metioned above.

If you want to turn above switch into a light, you can use the following: (thanks to@frenck for his script)

light:
- platform: template
  lights:
   livingroom:
     friendly_name: "light livingroom"
     entity_id: switch.light_livingroom
     value_template: "{{ is_state('switch.light_livingroom', 'on') }}"
     turn_on:
        service: switch.turn_on
       data:
          entity_id: switch.light_livingroom
     turn_off:
        service: switch.turn_off
        data:
           entity_id: switch.light_livingroom

now i realise since this is my first time tinkering with HA, this probably not the cleanest way to get this going, but ey it works, i can even call it trough my google home :slight_smile:

/edit, now i need to learn how to format on this forum :stuck_out_tongue:
/edit2 simplified the method

creating lightswitch.ch works, and in automations.yaml adding

  • platform: command_line
    switches:
    light_yournamehere:
    command_on: sh ./lightswitch.sh your firefox f12 3-4 digit code here on
    command_off: sh ./lightswitch.sh your firefox f12 3-4 digit code here off
    friendly_name: name you want hassio to show here
    command_timeout: 3 (timeout time in seconds here)

the whole text, per switch
and indeed it makes an off and on symbol at next full restart for each switch and succeeds to send the commands to the elro smartwares box
thanks !