Great to hear there are a few who have this working with HA, mine is being delivered this afternoon, so I have a new little project for this weekend.
Which device type should I select within ESPhome for this socket? Is this generic ESP8266?
Thanks in advance.
Yes use that one, just tested it , this works for me, so yes use that one and edit it later if it doesn’t look like this:
esphome:
name: socket
platform: ESP8266
board: esp01_1m
Try refreshing browser before compiling, kind of remember something about that
That worked, ta.
Firmware is in and device showing up as online in esphome, but how are the entities added?
Do I need to append your config you posted a few days back and edit this within esphome ( garden_socket.yaml) then upload to the device?
Would I append the additional config after the ota line in the existing config and then upload this?
I just went for it and the entities are now there, this was my first device with esphome thanks for your help.
Glad it worked, let me know how the install into the weatherproof housing goes.
I disassembled my existing 2 gang weatherproof enclosure and removed the socket face plate, the new Ener-J socket height is about 5mm to large to fit between the fixing points. So need to start looking for a suitable new 2 gang enclosure which shall accept this new socket.
That’s annoying, thought all sockets were a standard size !
It is because of the screw-less design, the black back fixing plate was the standard size, the clip on face plate is slightly larger than a standard socket face place would be. I tried offering this upto a couple of others weatherproof 2 gang enclosures from B&Q and Toolstation, I could not find one suitable one without some cutting and hacking either the box or the face plate, not to say there is not one out there.
I have decided to re-deploy this one inside the home, and I shall order the weatherproof one when suppliers have some stock available again.
I guess it is just a case of deleting the device from esphome, and re-flashing with a different device name?
Also thinking that I should be using a more descriptive names for the entities within the esphome yaml config, as I shall end up having a number of left/right socket_2, 3, 4 now I’m planning on buying a few more for inside.
Yes, obviously can’t tuya flash anymore but if you copy all the config to clipboard, delete the node from esphome, create a new one with your new name and then paste the config back in and reflash OTA. You’ll need to reload the browser before you can edit the new node.
Just to throw some ideas around, this is the way I manage my wall sockets with one piece of code.
Therefore, if I update the code to include a new feature or want to change a password, I only have to do it once:
This is my node (I have a few of these)
wallsocket1.yaml
substitutions:
devicename: wallsocket1
upper_devicename: Wall Socket 1
<<: !include .wallsocket.yaml
This is my shared config for the wallsocket with credit to @Holdestmade for some bits! All the same type of wallsocket. If you use VSCode addon and rename the file with a ‘.’ (full stop or period) in front, it won’t show up in ESPhome.
.wallsocket.yaml
esphome:
name: ${devicename}
platform: ESP8266
board: esp01_1m
<<: !include .common.yaml
sensor:
- platform: wifi_signal
name: “WiFi Signal”
update_interval: 30s
switch:
- platform: gpio
pin: GPIO5
name: "Socket 1"
id: socket_1
icon: mdi:power-socket-uk
- platform: gpio
pin: GPIO12
name: "Socket 2"
id: socket_2
icon: mdi:power-socket-uk
binary_sensor:
- platform: status
name: "Status"
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "Button 1"
on_press:
then:
- switch.toggle: socket_1
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Button 2"
on_press:
then:
- switch.toggle: socket_2
output:
- platform: esp8266_pwm
id: op_green_led
pin:
number: GPIO13
inverted: True
light:
- platform: monochromatic
name: "LED"
output: op_green_led
id: green_led
effects:
- strobe:
name: Flash
- strobe:
name: Slow Flash
colors:
- state: True
duration: 1000ms
- state: False
duration: 1000ms
- strobe:
name: Fast Flash
colors:
- state: True
duration: 250ms
- state: False
duration: 250ms
And this is my common file with all my common settings.
.common.yaml
wifi:
ssid: !secret ap_ssid
password: !secret ap_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: $upper_devicename Fallback
password: !secret fallback_pass
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret api_pass
ota:
password: !secret api_pass
Thanks, I threw mine away anyway as the front covers fell off. Replaced them with BGHome ones
For anyone (like me) who comes here looking to integrate the EnerJ sockets to Home Assistant and decides they don’t have the equipment and/or knowledge to do the TuyaConvert/ESPhome conversion it’s worth noting that the Tuya cloud integration works out of the box.
So if you are not set on local-only and dont mind using cloud you can get up and running with these sockets in HA in minutes. Just add the sockets to the Tuya smart life app, follow the config guide for the HA Tuya integration and you’re good to go.
Bear in mind these sockets have been recalled due to a safety issue: