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

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

image image

Manufacturers: REV Ritter, GAO, EverFlourish

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

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

https://www.rev.de/DE_produkt_15058.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 9 of EMW302WF and 2 of EMW302WFO

Not tested: EMW302WF-CTL See here: https://www.rev.de/DE_produkt_15058.ahtml
image
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: (running nodejs 8.9.4 and java script version “ghoma 1.0.6”)

A new manual for later versions you can find here!

.

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!

2 Likes

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

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

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

@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.

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

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.

@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.

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

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?

@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).

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.

1 Like

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

@Celaeno1
The tutorial is clear enough, good work.

1 Like

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

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

Hi,

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

Thanks. It’s working now.

Dirk

1 Like

This topic has a Solution

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 …

1 Like