EverythingSmartHome / everything-presence-one

Official Repo for the Everything Presence One sensor!
390 stars 71 forks source link

Minor inconvenience - Firmware: Unavailable #66

Closed somejavadev closed 4 weeks ago

somejavadev commented 1 year ago

Hi,

Thanks for all the effort in the creation of the EP1, this is truly an awesome hackable sensor. Something I picked up which I haven't fully figured out why is that the Firmware under the Configuration section of home assistant shows 'unavailable' although under the Device Info it does show the firmware version:

Screenshot from 2023-05-22 17-40-14

If you compare this to another esp32dev I have:

Screenshot from 2023-05-22 17-41-46

Here it shows "Up To Date" under the Configuration section. I take it home assistant takes the Firmware attribute from the Configuration section to determine if it should alert you for new over the air updates.

The result of this is a minor inconvenience of not being alerted that the esphome firmware is outdated and being able to update it from home assistant. I say it's minor because one can simply update the firmware from ESP Home directly:

Screenshot from 2023-05-22 17-48-35

I compared both devices EP1 and a standard esp32dev's esphome yaml but couldn't easily identify what the reason for this could be. Is this normal for the Firmware attribute to display 'unavailable' and is the expected behaviour or might this be an incorrect configuration on my end?

EverythingSmartHome commented 1 year ago

Sorry I missed this, is it working now? I note that your config names are different from what the default would be when adopted, did you create these configs manually?

somejavadev commented 1 year ago

No problem at all. It still seems to be showing Unavailable. I added the sensors via the ESPHome interface using the config provided here: https://github.com/EverythingSmartHome/everything-presence-one/blob/main/everything-presence-one.yaml.

The steps I followed was:

Go to ESPHome in homeassistant Create a new device Give it a name. Click Next Click Skip the installation step

I then pasted the yaml from the main repo everything-presence-one.yaml as the configuration for the new device, I then renamed the values of the substations and gave the device a static IP address as below:

substitutions:
  name: "ep1-one"
  friendly_name: "ep1-one"
  project_name: "Everything Smart Technology.Everything Presence One"
  project_version: "1.1.5"
  temperature_offset: "-3"
  humidity_offset: "5"
  temperature_update_interval: "60s"
  illuminance_update_interval: "30s"
  pir_delay_off: "10s"
  occupancy_delay_off: "15s"
  hidden_ssid: "false"
  factory_reset_disabled: "true"
  uart_target_output_disabled: "true"
  uart_presence_output_disabled: "true"

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: true
  project:
    name: ${project_name}
    version: ${project_version}

esp32:
  board: esp32dev

logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  ap: {}
  manual_ip:
    static_ip: 192.168.4.64
    gateway: 192.168.4.1
    subnet: 255.255.255.0

captive_portal:

improv_serial:

esp32_improv:
  authorizer: none

dashboard_import:
  package_import_url: github://everythingsmarthome/presence-one/everything-presence-one.yaml@main
  import_full_config: false

light:
  - platform: status_led
    name: ESP32 status LED
    pin: GPIO32
    entity_category: config
    disabled_by_default: True
  - platform: binary
    name: mmWave LED
    restore_mode: RESTORE_DEFAULT_OFF
    output: mmwave_led_output
    entity_category: config
    disabled_by_default: True

output:
  - platform: template
    id: mmwave_led_output
    type: binary
    write_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - if:
          condition:
            lambda: !lambda return state;
          then:
            - uart.write: "setLedMode 1 0"
          else:
            - uart.write: "setLedMode 1 1"
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 3s
      - switch.turn_on: mmwave_sensor

i2c:
  sda: 26
  scl: 25
  scan: true

sensor:
  - platform: shtcx
    temperature:
      name: Temperature
      filters:
        offset: ${temperature_offset}
    humidity:
      name: Humidity
      filters:
        offset: ${humidity_offset}
    address: 0x70
    update_interval: ${temperature_update_interval}
  - platform: bh1750
    name: Illuminance
    address: 0x23
    update_interval: ${illuminance_update_interval}

binary_sensor:
  - platform: gpio
    name: mmWave
    id: mmwave
    device_class: occupancy
    pin:
      number: GPIO15
      mode: INPUT_PULLDOWN
  - platform: gpio
    pin:
      number: 33
      mode: INPUT_PULLDOWN
    name: PIR
    id: pir_motion_sensor
    device_class: motion
    filters:
      - delayed_off: ${pir_delay_off}
  - platform: template
    name: Occupancy
    id: occupancy
    device_class: occupancy
    filters:
      - delayed_off: ${occupancy_delay_off}
    lambda: |-
      if ( id(mmwave).state or id(pir_motion_sensor).state) {
        return true;
      } 
      else if (id(mmwave).state == 0 and id(pir_motion_sensor).state == 0) {
        return false;
      } 
      else {
        return id(occupancy).state;
      }
uart:
  id: uart_bus
  tx_pin: GPIO13
  rx_pin: GPIO14
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: true
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

switch:
  - platform: template
    name: mmWave sensor
    id: mmwave_sensor
    disabled_by_default: True
    entity_category: config
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON
    turn_on_action:
      - uart.write: "sensorStart"
      - delay: 1s
    turn_off_action:
      - uart.write: "sensorStop"
      - delay: 1s

  - platform: template
    name: UART presence output
    id: uart_presence_output
    entity_category: config
    internal: ${uart_presence_output_disabled}
    optimistic: true
    turn_on_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: "setUartOutput 1 1"
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 3s
      - switch.turn_on: mmwave_sensor
    turn_off_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: "setUartOutput 1 0"
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 3s
      - switch.turn_on: mmwave_sensor

  - platform: template
    name: UART target output
    id: uart_target_output
    entity_category: config
    internal: ${uart_target_output_disabled}
    optimistic: true
    assumed_state: false
    turn_on_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: "setUartOutput 2 1 1 1"
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 3s
      - switch.turn_on: mmwave_sensor
    turn_off_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: "setUartOutput 2 0"
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 3s
      - switch.turn_on: mmwave_sensor

number:
  - platform: template
    id: mmwave_distance
    name: mmWave distance
    icon: mdi:arrow-left-right
    entity_category: config
    min_value: 0
    max_value: 800
    initial_value: 315
    optimistic: true
    step: 15
    restore_value: true
    unit_of_measurement: cm
    mode: slider
    set_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: !lambda int cm = (int)ceil(x / 15.0);
          std::string cms = "detRangeCfg -1 0 " + to_string(cm);
          return std::vector<unsigned char>(cms.begin(), cms.end());
      - delay: 1s
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - delay: 1s
      - switch.turn_on: mmwave_sensor

  - platform: template
    name: mmWave off latency
    icon: mdi:clock-end
    entity_category: config
    id: mmwave_off_latency
    min_value: 1
    max_value: 60
    initial_value: 15
    optimistic: true
    step: 1
    restore_value: true
    unit_of_measurement: seconds
    mode: slider
    set_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: !lambda |-
          std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
          return std::vector<unsigned char>(mss.begin(), mss.end());
      - delay: 1s
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - delay: 1s
      - switch.turn_on: mmwave_sensor

  - platform: template
    name: mmWave on latency
    icon: mdi:clock-start
    id: mmwave_on_latency
    entity_category: config
    min_value: 0
    max_value: 60
    initial_value: 0
    optimistic: true
    step: 0.5
    restore_value: true
    unit_of_measurement: seconds
    mode: slider
    set_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: !lambda |-
          std::string mss = "setLatency " + to_string(id(mmwave_on_latency).state) + " " + to_string(id(mmwave_off_latency).state);
          return std::vector<unsigned char>(mss.begin(), mss.end());
      - delay: 1s
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - delay: 1s
      - switch.turn_on: mmwave_sensor

  - platform: template
    name: mmWave sensitivity
    icon: mdi:target-variant
    id: mmwave_sensitivity
    entity_category: config
    min_value: 0
    max_value: 9
    initial_value: 7
    optimistic: true
    step: 1
    restore_value: true
    set_action:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write:
          !lambda std::string mss = "setSensitivity " + to_string((int)x);
          return std::vector<unsigned char>(mss.begin(), mss.end());
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 1s
      - switch.turn_on: mmwave_sensor

button:
  - platform: restart
    id: restart_internal
    entity_category: config
    internal: true
  - platform: template
    name: Restart mmWave sensor
    id: restart_mmwave
    entity_category: config
    internal: true
    on_press:
      - uart.write: "resetSystem"
  - platform: template
    name: Restart
    icon: mdi:restart
    entity_category: config
    disabled_by_default: True
    on_press:
      - button.press: restart_mmwave
      - button.press: restart_internal
  - platform: safe_mode
    internal: false
    name: Safe mode
    entity_category: config
    disabled_by_default: True
  - platform: template
    name: Factory reset mmWave
    icon: mdi:cog-counterclockwise
    id: factory_reset_mmwave
    internal: ${factory_reset_disabled}
    entity_category: config
    on_press:
      - switch.turn_off: mmwave_sensor
      - delay: 1s
      - uart.write: "resetCfg"
      - delay: 3s
      - switch.turn_on: mmwave_sensor

I then deployed/installed it by letting ESPHome compile the code (legacy format) and installed it with esp_flasher via an USB cable.

EverythingSmartHome commented 1 year ago

That's perhaps the issue is your manually copying and pasting the config and then renaming entities in code (rather than the HA UI) - did you try using the standard way?

fhold commented 11 months ago

I have the same issue. Interestingly I have 2 EPO Sensors and only one has the problem. I just did a fresh firmware install via cable and website (Version ESPHome 2023.7.1) but the problem is the prevails. In Homeassistant it shows unavailable. If I connect via cable and use the web-console you provide via your website I can see it's Version ESPHome 2023.7.1. The problem is, that no new ESP Update are installed. Would love to fix that somehow

somejavadev commented 11 months ago

@EverythingSmartHome I have tried the default config and rename the entities in the UI but for some reason the Firmware section remains Unknown. Installation method was as follows:

Firmware: 2023.8.3 (Sep 16 2023, 14:25:21)
Hardware: 1.1.6
Home Assistant 2023.9.2
Supervisor 2023.09.2
Operating System 10.5
Frontend 20230911.0 - latest

@fhold mine strangely occurs with all three my devices. Did you make any changes to the config you got from github?

fhold commented 9 months ago

@somejavadev I did not make any changes I used the standard installation process and one is working fine the other one not and I'm not able to do updates on the faulty one. @EverythingSmartHome any idea what we can do?

therealeldaria commented 8 months ago

It is the same for me, I used the installation from the website. https://everythingsmarthome.github.io/everything-presence-one/updating.html I have not done any renaming or anything like that.

I can see the device in Home Assistant but not in the ESPHome addon, and the firmware is showing Unknown. There was also a recent update to ESPHome and all my ESP's wanted to be updated, but not the EP1, so my thinking is that it is not entirely connected to the rest of the ESPHome eco system.

Not sure if it is related but the EP1 is on a VLAN with no internet access. But I assume it does not need any access to internet.

EverythingSmartHome commented 4 weeks ago

Please open a new issue if this is still a problem but will close for now