huizebruin/s0tool

How to update manually via EspHome

zjean opened this issue · 1 comments

zjean commented

Hi,
I am using the s0tool solely as watermeter. It works well, I am very happy with it.
I made a few adjustments to the entity names when first flashing the s0tool via Esphome.
What are the steps of performing updates to my s0tool?

Which file of the repo should I use (and adjust it to my entity names)?
Thanks!

Below my current yaml, but I would like to incorporate the energy dashboard feature.

# Delen en bewerken mag maar laat deze eerste regels staan.
# Bron : https://www.huizebruin.nl
# Bron File : https://github.com/huizebruin/s0tool/tree/main/esphome
# © Huizebruin.nl
substitutions:
  vdate: "v22.08.15"
  device_description: watermeter (s0tool) gemaakt door huizebruin.nl versie ${vdate} .
  name: s0tool

esphome:
  name: ${name}
  platform: ESP8266
  board: d1_mini
  comment: '${device_description}'
  project:
    name: huizebruin.${name}
    version: "${vdate}"
  
dashboard_import:
  package_import_url: github://huizebruin/s0tool/esphome/watermeter.yaml

improv_serial:
  
wifi:
# secrets rechts boven binnen esphome (vanaf versie 2021.12.0 - 11th standaard in de secrets)
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  fast_connect: true
  use_address: s0tool.local
  domain: ".local"
#------------------------##------------------------##------------------------##------------------------#
# ⬇ Hieronder niets veranderen tenzij je het overal goed aanpast ⬇ #
# ⬇ Schakel fallback-hotspot (captive portal) in voor het geval de wifi-verbinding mislukt ⬇ #
  ap:
    ssid: "${name}"

web_server:
  port: 80
  
captive_portal:
# ⬇ Enable logging ⬇ # 
logger:
  level: INFO
  
#  # ⬇ Enable Home Assistant API ⬇ # 
api:
  services:
    - service: meterstand_water
      variables:
        meter_value: int 
      then:
        - globals.set:
            id: totalWaterUsage
            value: !lambda "return ( meter_value ) ;"

globals:
  - id: totalWaterUsage
    type: int 
# ⬇ Bij het updaten onder de waarde, verander dit in no voor 1 run  ⬇ # 
    restore_value: no      
# ⬇ Bij het flashen,pas dit aan! ⬇ #        
    initial_value: '201' 

ota:
  safe_mode: true
  reboot_timeout: 10min
  num_attempts: 5

#  ⬇ Enable time component voor reset elke nacht ⬇ #
time:
  - platform: homeassistant
    id: time_homeassistant
    on_time_sync:
      - component.update: S0tool_uptime_timestamp

sensor:
#------------------------# Watermeter #------------------------#
# ⬇ watermeter pulsen ⬇ #
  - platform: pulse_counter
    pin: D2
    id: watermeter_pulse
    name: "watermeter pulse"
    state_class: measurement
    accuracy_decimals: 1

# ⬇ Totaal watermeter ⬇ #      
    total:
      id: sensor_pulse_meter_total
      name: "watermeter Totaal"
      icon: "mdi:cube-outline"
      state_class: "total_increasing"
      unit_of_measurement: m3
      accuracy_decimals: 3
      filters:
      - multiply: 0.001
      
# ⬇ Watermeter stand bij benadering ⬇ #
  - platform: template
    id: watermeter_total
    name: "watermeter stand"
    state_class: "total_increasing"
    icon: mdi:water
    unit_of_measurement: m3
    accuracy_decimals: 3
    lambda:       
      return id(sensor_pulse_meter_total).state + id(totalWaterUsage);
      
# ⬇ watermeter l/min ⬇ #
  - platform: template
    name: "Water verbruik Liter"
    id: watermeter_flow
    accuracy_decimals: 1
    unit_of_measurement: "l/min"
    icon: "mdi:water"
    lambda: return (id(watermeter_pulse).state);
#------------------------#  sensoren #------------------------#
  - platform: uptime
    id: S0tool_uptime

  - platform: template
    id: S0tool_uptime_timestamp
    name: "online sinds"
    device_class: "timestamp"
    accuracy_decimals: 0
    update_interval: never
    lambda: |-
      static float timestamp = (
        id(time_homeassistant).utcnow().timestamp - id(S0tool_uptime).state
      );
      return timestamp;  

  # WiFi signal
  - platform: wifi_signal
    name: "${name} - WiFi Signal"
    update_interval: 120s  
        
# ⬇ versie verbinding informatie sensoren voor in ha ⬇ #
  - platform: wifi_signal
    name: "${name} - WiFi Signal"
    update_interval: 120s
    
text_sensor:
  - platform: template
    name: "s0tool_versie"
    id: s0tool_versie
    icon: "mdi:label-outline"
    update_interval: 6h
    lambda: |-
      return {"${vdate}"};

  - platform: wifi_info
    ip_address:
      name: IP-adres
      id: s0tool_ip_adres
      icon: mdi:ip-network
    ssid:
      name: Netwerk
      id: s0tool_netwerk
      icon: mdi:access-point-network
    mac_address:
      name: Mac-adres
      id: s0tool_mac_adres
      icon: mdi:folder-key-network-outline

# ⬇ restart button voor de s0tool ⬇ #
button:  
  - platform: restart
    name: "Restart device"

I made a flash page so its easy te flash.
https://huizebruin.github.io/s0tool/

because there is a lot changed after the version you are using.
i made it now that easy when u press the install button inside the ESPHhome dashboard it wil get the latest version from GitHub.

and u only can change the names inside Home Assistant.
And the latest version works with the Energy dashboard for Home Assistant.