Energenie EG-PMS2-LAN and similar

Anyone familiar with http://energenie.com/item.aspx?id=7416 ?

There is a python library available https://pypi.python.org/pypi/energenie and it generally is also fairly easily usable with telnet.

Anyone has one of those and wants to maintain a component?

Are you sure the python library you refer to is for this board? Energenie have other products for the pi, and I think this might be a library for those.

Since i do not have the hardware yet i do not know if it supports this specific device.
I have ordered one though…

Ok, i received mine and well, its clunky as heck.

But,

the model i bought has 4 switchable plugs and a webinterface.

With some peeking i saw that basically switching a port on or off is just a post request - maybe with basic auth.

like this:

Request URL:http://192.168.0.25/
Request Method:POST
Content-Type:application/x-www-form-urlencoded
Host:192.168.0.25
form data:
cte1:1
cte2:
cte3:
cte4:

so this is witching plug 1 on - off is just cte1:0

need to try if basic auth works :slight_smile:

no auth required to switch:

import requests
r = requests.post(“http://192.168.0.25”, data={“cte1”:0,“cte2”:0,“cte3”:0,“cte4”:1}

works fine.

erm. Ok.

Hi

I have the PMS-LAN too, and would like to control it via Home Assistant too, can you help to understand what you’ve done to do it ?

Thanks !

Hi,
i have not yet done much - i still don’t really see how to poll the status in a nice way.

Thanks, I wish I could help but sadly I don’t have the necessary programming skills/understanding .

I came across this on GitHub too - but it looks like it just seems to turn the sockets on/off - https://github.com/zdazzy/eg-pyms-lan

Hopefully it can be a product that could be supported in the future

Still curious if someone has got this device working with HA

any new status?

You should be able to use the script from github in a command line switch.

Thanks,

I now have example of how to control my Energenie PMS-LAN, which I’m trying to work through on the micasverde.com (Vera Control) forum- on a quest to see how I can get Vera (and by association HASS) to run them.

As it seem both curl or wget can do the job.

The first thing you need to do is login (the default password is 1, so I have left it as that for those examples) - and this times out after I think 3-5 mins

Using curl,

curl -s -d "pw=1" http://192.168.1.90/login.html

or wget

wget -q -O - --post-data="pw=1" http://192.168.1.90/login.html 

And the to turn the sockets on or off you set the value of your target to either 1 or 0 e.g.

Turn on socket 4 (via curl)

curl -s -d "cte4=1" http://192.168.1.90/

Turn off socket 4 (via curl)

curl -s -d "cte4=0" http://192.168.1.90/

Turn on socket 4 (via wget)

wget -q -O - --post-data="cte4=1" 'http://192.168.1.90/'

Turn off socket 4 (via wget)

wget -q -O - --post-data="cte4=0" 'http://192.168.1.90/'

Please could someone help me with this code - which I’m trying to get working based on this guide.

The use of quotes in the curl command seem to be causing me issues ? Plus I’m not sure what to do with the “command_state” value ?

switch:
  platform: command_line
  switches:
    arest_pin_four:
      command_on: "/usr/bin/curl -s -d "pw=1" http://192.168.1.90/login.html && curl -s -d "cte4=1" http://192.168.1.90/ && curl -s -d "" http://192.168.1.90/login.html"
      command_off: "/usr/bin/curl -s -d "pw=1" http://192.168.1.90/login.html && curl -s -d "cte4=0" http://192.168.1.90/ && curl -s -d "" http://192.168.1.90/login.html"
      command_state: "/usr/bin/curl -X GET http://192.168.1.90"
      value_template: '{{ value == "1" }}'
      friendly_name: Energenie PMS-LAN Multiblock

I have got it to work - by creating on and off commands for each of the 4 sockets. The key is that you need to send a login request first for the socket firmer - and then to help matters once the command is sent - , I send a log out (empty) request at the end…

switch:
  - platform: command_line
    switches:
      energenie4:
        command_on: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte4=1' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        command_off: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte4=0' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        friendly_name: Energenie Socket 4
  - platform: command_line
    switches:
      energenie3:
        command_on: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte3=1' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        command_off: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte3=0' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        friendly_name: Energenie Socket 3
  - platform: command_line
    switches:
      energenie2:
        command_on: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte2=1' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        command_off: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte2=0' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        friendly_name: Energenie Socket 2
  - platform: command_line
    switches:
      energenie1:
        command_on: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte1=1' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        command_off: "/usr/bin/curl -s -d 'pw=1' http://192.168.1.90/login.html && curl -s -d 'cte1=0' http://192.168.1.90/ && curl -s -d '' http://192.168.1.90/login.html"
        friendly_name: Energenie Socket 1

If anyone can advise on how I can capture the ‘state’ of each socket via the UI that would be great !! When the curl commands are sent a page of HTML is sent back, which looks like it can confirm the status of each socket.??

1 Like

You can try using my script for Energenie PMS-LAN, which allows you to control switches through the MQTT server. The script on the python here , here’s the code for home assistant:
switch:
- platform: mqtt
name: socket_1
state_topic: “energenie/socket1/state/”
command_topic: “energenie/socket1/state/”
availability_topic: “energenie/online/”
payload_on: “1”
payload_off: “0”
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: socket_2
state_topic: “energenie/socket2/state/”
command_topic: “energenie/socket2/state/”
availability_topic: “energenie/online/”
payload_on: “1”
payload_off: “0”
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: socket_3
state_topic: “energenie/socket3/state/”
command_topic: “energenie/socket3/state/”
availability_topic: “energenie/online/”
payload_on: “1”
payload_off: “0”
optimistic: false
qos: 0
retain: true
- platform: mqtt
name: socket_4
state_topic: “energenie/socket4/state/”
command_topic: “energenie/socket4/state/”
availability_topic: “energenie/online/”
payload_on: “1”
payload_off: “0”
optimistic: false
qos: 0
retain: true

1 Like