G-Homa Wifi Smart Socket “EMW302WF“ and “EMW302WFO” with OpenHAB2

openhab2
hardware
g-homa
Tags: #<Tag:0x00007f014bde6a68> #<Tag:0x00007f014bde6900> #<Tag:0x00007f014bde6748>

(Alex) #1

G-Homa Wifi Smart Socket “EMW302WF“ and “EMW302WFO” with OpenHAB2

Manufacturers: REV Ritter, GAO, EverFlourish

http://www.rev.de/DE_produkt_13876.ahtml

http://www.rev.de/DE_produkt_13999.ahtml

http://www.g-homa.com/index.php/en/products

Technical data: 230 V~, 16 A, max. 3500 W


(Available in Germany at OBI, Saturn, Globus Baumarkt, Toom Baumarkt, ELV and so on…)

Prices for EMW302WF: OBI (9,99 EURO) (at my local OBI !), Saturn (15 EURO), Globus: (24,95 EURO), ELV (29,00 EURO)

Price for EMW302WFO: OBI (14,99 EURO) (at my local OBI !)

I got it running with openhab2! I have 7 of EMW302WF and 2 of EMW302WFO

Not tested: EMW302WF-CTL

(see here)


Also could run, but has to be tested!!

They have mounted the following wifi module: HF-LPB100 or HF-LPC100 like Orvibo S20 or Silvercrest SWS-A1.

I tested Orvibo-Binding, but it was not running! Here is a different way how to get them running:

INSTRUCTIONS:

If you don’t want to use cloud based G-Homa App and need an integration into OpenHAB2, you can use your own “control server” written in nodejs.

See here: https://github.com/rodney42/node-ghoma
or here: https://www.npmjs.com/package/ghoma

Prerequisites: G-Homa App (available here)
Android: https://play.google.com/store/apps/details?id=com.everflourish.android&hl=de
iOS : https://itunes.apple.com/de/app/g-homa/id887296762?mt=8

nodejs (LTS Version)
see here: https://nodejs.org/en/download/

openHAB binding: http and transformation: map

Download also the following manual from here:
http://www.sabreadv.com/wp-content/uploads/HF-LPC100-User-Manual-V1.0.pdf

Important information:

FIRMWARE of ghoma wifi socket <= 1.0.06 (check if ‘manufacturing date’ on product packaging is 10.14 or before!), then see steps 1-12 and 14-19

FIRMWARE >1.0.06 --> no html-configuration available, then see steps 1-11 and 13-19

  1. Install nodejs and including npm

  2. Install ghoma (be sure that “net” and “express” also is installed!)
    Also see tutorial here: https://www.npmjs.com/package/ghoma/tutorial

  3. you will get four javascripts in a subfolder ‘ghoma’: ghoma.js, example.js, config.js and express_example.js

  4. modify line 69 in express_example.js
    from res.send(JSON.stringify(plug)); to res.send(JSON.stringify(plug.state));

  5. run express_example.js (e.g. from Windows-commandline: node express_example.js)
    this will start a “mini-webserver” (port: 3000) and a g-homa-control-server (port: 4196) on your local machine

  6. confirm firewall-exception, if poping up.

  7. plug your ghoma wifi socket into a power socket

  8. press button on your wifi socket more than 3 seconds

  9. connect your notebook or smartphone to wifi with SSID “G-Homa”

  10. open a browser to address http://10.10.100.254 (user: admin, pw: admin)

  11. if site in step 10 is not available, your firmware is >1.0.06, go to step 13

  12. next steps (a - g) are for firmware <=1.0.06
    a. go to “STA Setting”, scan and choose your local wifi
    b. important: always press ‘save’ after you made changes, but do NOT reboot your wifi-socket!
    c. fill in your SSID password and (optional) disable ‘Obtain IP Address automatically’)
    d. (optional) fill in a manual IP-Address, Subnetmask, Gateway, DNS Server
    e. go to “Other Setting’: fill in ‘Serveraddress’: this is where you started the express_example.js (in point 5 above).
    f. go to “Work Mode” and choose “STA mode”, press “save” and NOW reboot your socket.
    g. connect your notebook or smartphone back to your home-wifi. Go to step 14

  13. next steps (a - h) are for firmware >1.0.06
    a. open G-Homa App, add new socket, choose your wifi SID and fill in wifi password.
    b. identify IP address of your new socket with your router web interface at network monitor. This will be ‘ghoma address’ in step c.
    c. run config.js which you got in step 3:
    node config.js ‘ghoma address’ ‘control server address’ ‘control server port’
    (‘control server port’ has to be: 4196)
    e.g. node config.js 192.168.100.55 192.168.100.44 4196
    d. if you want to use DHCP for your socket, all done, go to step 14.
    e. if you want a static IP address for your socket, go to step f.
    f. comment line 40 and line 41 in config.js
    //send(new Buffer(“AT+NETP=TCP,Client,”+controlPort+","+controlServer+"\r"));
    //send(new Buffer(“AT+NETP\r”));
    g. fill in 3 new lines after line 41
    send(new Buffer(“AT+WANN=static,192.168.100.229,255.255.255.0,192.168.100.1\r”));
    send(new Buffer(“AT+WANN\r”)); // See the network settings
    send(new Buffer(“AT+Z\r”)); //reboot socket

     192.168.100.229 = static IP address of socket, 255.255.255.0 = subnetmask, 192.168.100.1=gateway
    

then run step 13 c. again, (now use your NEW static IP-Address of the socket in the command!)
h. reboot your socket, power off and power on again
14. open a webbrowser with address: http://IP-Address:3000/list where IP-Address is IP of your local machine in point 5.
15. now you will see something like that: [{“id”:“3ef996”,“state”:“off”}], where “id” is the short-MAC of your ghoma wifi socket.
16. in openhab2 install the following Add-on: http
17. in openhab2 install the following transformation: map
18. create an onoff.map containing the following:
“on”=ON
“off”=OFF
19. items-file:

Switch GHoma1	"G-Homa Socket 1"	{ http=">[ON:GET:http://192.168.100.44:3000/on/3ef996] >[OFF:GET:http://192.168.100.44:3000/off/3ef996] <[http://192.168.100.44:3000/state/3ef996:60000:MAP(onoff.map)]" }

where <192.168.100.44> has to be replaced with 'IP-Address of your mini-webserver’
and <3ef996> has to be replaced with “id” of your ‘ghoma wifi socket’ (in step 15) and 60000 = milliseconds time interval. (=every 60 seconds)

Have fun!


(Alex) #2

@danielwalters86 Maybe something for you? Enhancement of orvibo-binding?


(Daniel Walters) #3

Unlikely unless they use the same UDP protocol as the Orvibo S20 sockets (which it doesn’t appear to).


(Alex) #4

Thanks. UDP and Port 10000 should be no problem. I’ll check, if the protocol is similar and maybe easy to adopt.


(Alex) #5

@danielwalters86 here is my compare for ON/OFF command. They are nearly similar…

G-Homa also sending init1, init2 and a heartbeat, but I don’t exactly know how Orvibo is doing that…

Maybe you have more experience to compare it? Maybe it’s worth it.


(Alex) #6

Maybe there’s someone else who’s interested in an enhancement of Orvibo binding?


(Daniel Walters) #7

As the protocol is different it should IMO have it’s own binding.

It seems unintuitive to have to install the Orvibo binding for these G-Homa devices when they don’t speak the Orvibo protocol.


(Alex) #8

@danielwalters86 I read in some other forums that Orvibo S20 and G-Homa have the same wifi module mounted. So I tried Orvibo binding before I exactly knew that the protocols are different.

A new binding only is necessary, if enough people would like to have one. For me, it’s ok to run G-Homa with http binding.


(Alex) #10

Has anyone tried G-Homa already? Please give feedback! Thanx!


(Christian) #11

Hello Alex,

i tried to add a EMW302WF socket. But my controlserver server is crashing when the smart socket tries to connect.
Error:

ghoma express example app start listening on port 3000 for http requests.

/etc/node_modules/ghoma/ghoma.js:197
    var prefixPos = buffer.indexOf(PREFIX);
                           ^
TypeError: Object Z�

My firmware is 1.8.26.

Any ideas?


(Alex) #12

@Brain0verflow

It seems that ghoma.js got a TypeError.

I’m sorry, but I’m not the author of ghoma.js, maybe you can contact him? see here:
https://www.npmjs.com/~rodney42

Did you follow ALL the steps 1-11 and 13-19 ?? I have two EMW302WFO with firmware 1.8.26, they are both running!

Did you made an allow rule in your firewall? Ports 3000, 4196 ? I have Windows and I was asked when I started ghoma-listeningserver at first time…(“Allow it in the firewall?” --> (Yes/No).


(Christian) #13

The error occurs on my Raspberry PI.
Tested under windows -> works.

I wrote an email to the author.

Edit: My NodeJS Version on the RPi was too old, it’s running now.


(Alex) #14

@Brain0verflow
Ok, good to hear. Is above “Tutorial” easy to understand or is there something missing or not clear enough?


(Christian) #15

@Celaeno1
The tutorial is clear enough, good work.


(Dirk Stichling) #16

Hi.

Yesterday I bought an EMW302WFO and tried to use it with your solution. The firmware version of the socket is 1.8.26. I followed steps 1-11 and 13-14. Everything seems to be fine. However, when I open http://IP-Address:3000/list I only get an empty list: []

I configured the socket using this command:

root@d56ec58570a3:/ghoma/node_modules/ghoma# node config.js 192.168.178.48 192.168.178.43 3000
SEND      : HF-A11ASSISTHREAD
LISTENING : 0.0.0.0:37142
RECEIVE   : 192.168.178.48,ACCF23DBEC30,HF-LPB100
SEND      : +ok
SEND      : AT+VER
SEND      : AT+NETP=TCP,Client,3000,192.168.178.43
SEND      : AT+NETP
RECEIVE   : +ok=GAO,Outdoor,1.8.26


RECEIVE   : +ok


RECEIVE   : +ok=TCP,Client,3000,192.168.178.43


CLOSING

192.168.178.43 is the address where the server is running on port 3000. 192.168.178.48 is the ip of the socket.

The blue LED of the socket is blinking slowly.

The server is running within a Docker container. The only open port is TCP 3000.

Thanks for any help,
Dirk


(Dirk Stichling) #17

Ok, I found the error. For me it wasn’t clear that the server opens two ports, 3000 as a web API server and 4196 as the G-Homa server. Therefore I has to set port 4196 as the control port using config.js.

Now, it works.

Dirk


(Christian) #18

Hi,

Use Port 4196 for the socket config.
Like in the example:
node config.js 192.168.100.55 192.168.100.44 4196


(Dirk Stichling) #19

Thanks. It’s working now.

Dirk


(Alex) #20

This topic has a Solution


(Richard Fudge) #21

Great work on here - I had a problem with the latest ghoma nodejs module and openhab. It appears to need a better filter to get the state updating correctly.

Anyway, if it helps anyone else I have a JavaScript transform and a docker container that encapsulates all the work by others.

Transform and docker file here. https://github.com/opulentrich/ghoma-docker

Docker container can run like this :
docker run -d -p 3000:3000 -p 4196:4196 -n ghoma-proxy opulentrich/ghoma-proxy

The config commands in this thread can be run like this
docker exec ghoma-proxy nodejs /node_modules/ghoma/config.js …