JamesSwift/localbytes-plug-pm

Changing Default Values / Using Substitutions

harryjmcc1 opened this issue · 3 comments

Adding "default_state" to yaml does not work and causes the device to fail to connect to wifi.

substitutions:
  name: "localbytes-dishwasher"
  default_state: "ALWAYS_ON"
packages:
  localbytes.plug-pm: github://JamesSwift/localbytes-plug-pm/localbytes-plug-pm.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

Current solution is to remove the "default_state" and OTA update on the webui and use Home Assistant to turn on when connected to network.

Thanks!

Interesting. I'm not sure why that alteration would cause it to fail to connect to wifi, it's completely separate from the wifi module.

I've tried to reproduce what you describe, but it's working fine for me. Can you walk me through the steps in more detail? What version of ESPHome are you using?

No problem.

I adapt the device following the documentation and I have it integrated into Home Assistant and everything works perfectly.
It is only when I go back and then add the substitutions that it no longer connects to the Wifi and instead fails back to AP mode. Re-entering the wifi details via the webui does not allow it to connect to the network either.
This is consistent among all my Localbyte plugs on ESPHome, I have 6 currently.

I am using ESPHome via docker (esphome/esphome:latest), current version is v2023.2.2

Let me know if there is anything else I can provide. Thanks!

Thanks for the extra info. I'm afraid I'm no closer to finding the problem though. Here's a configuration from one of my plugs which is working fine. It's almost identical to yours, apart from I change the friendly_name substitution and also I don't redefine the esphome->name.

substitutions:
  name: fridge
  friendly_name: Fridge
  default_state: "ALWAYS_ON"
packages:
  localbytes.plug-pm: github://JamesSwift/localbytes-plug-pm/localbytes-plug-pm.yaml@main
esphome:
  name_add_mac_suffix: false

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

I'm running ESPHome in docker and on the same version as you too. Could you try my config (but change the name and friendly name as appropriate)? It shouldn't make any difference, but I'm not really sure what else to try.