Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change EMS-ESP device sensor types in Home Assistant #751

Closed
laszlojakab opened this issue Nov 16, 2022 · 9 comments
Closed

Change EMS-ESP device sensor types in Home Assistant #751

laszlojakab opened this issue Nov 16, 2022 · 9 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@laszlojakab
Copy link

laszlojakab commented Nov 16, 2022

Is your feature request related to a problem? Please describe.
I'm using EMS-ESP32 with Home Assistant. My problem is that some of EMS-ESP device sensors have "wrong type". I know I could use template sensors to fix the problem but it would nice if EMS-ESP could register these sensors with the "correct type". The following sensors are problematic:

  • status
  • ntp_status
  • uptime

Describe the solution you'd like
I think the following modifications needed:

  • status: it should be registered as a binary_sensor with connectivity device class and not as a sensor. By doing this Home Assistant will localize the value to connected or disconnected or whatever based on the selected language. Also have to mention that Home Assistant dashboard can change color of binary sensor's icon natively based on it state. With the current string value connected it is only possible if I introduce a template binary sensor or if I'm using a third party ui component.
  • ntp_status: same as status sensor.
  • uptime: the natively supported uptime sensor in Home Assistant returns the timestamp of booting in ISO 8601 format (eg: 2022-11-15 20:46:38.049117). If NTP is enabled EMS-ESP could also provide this value. The device class of the sensor should be timestamp. By this modification Home Assistant can natively convert the elapsed time to more easily readable text on the dashboards (for example: 2 days ago). One more note: the devices in Home Assistant which reports uptime and has an RTC or NTP connection reports the booting time as uptime.
@laszlojakab laszlojakab added the enhancement New feature or request label Nov 16, 2022
@proddy
Copy link
Contributor

proddy commented Nov 17, 2022

Good points. Which version are you using?

@laszlojakab
Copy link
Author

v3.4.4

@proddy
Copy link
Contributor

proddy commented Nov 18, 2022

regarding the 'uptime' ISO 8601 is not good for showing the elapsed time. It's better to add the boot time to the MQTT info topic (if NTP is running) :

{
  "event": "connected",
  "version": "3.5.0b9",
  "connection": "ethernet",
  "hostname": "ems-esp",
  "MAC": "A8:05:2A:68:64:DF",
  "IPv4 address": "192.168.1.134/255.255.255.0",
  "IPv4 gateway": "192.168.1.1",
  "IPv4 nameserver": "192.168.1.1"
}

@proddy
Copy link
Contributor

proddy commented Nov 19, 2022

and status is used as a last will message (https://www.home-assistant.io/integrations/mqtt/#birth-and-last-will-messages). Do you want to see if the EMS-ESP is online or just that it's connected to the EMS bus?

@proddy proddy self-assigned this Nov 20, 2022
@proddy proddy added this to the v3.5.0 milestone Nov 20, 2022
proddy added a commit to proddy/EMS-ESP32 that referenced this issue Nov 20, 2022
proddy added a commit that referenced this issue Nov 20, 2022
use HA connectivity device class #751
@proddy
Copy link
Contributor

proddy commented Nov 20, 2022

I made the changes to status. For uptime, it needs more thinking and some help from your end

@laszlojakab
Copy link
Author

Thanks for the updates! What do you need from me about uptime?

@proddy
Copy link
Contributor

proddy commented Nov 26, 2022

Thanks for the updates! What do you need from me about uptime?

see my earlier response. uptime is elapsed time and shouldn't change. I think you're after the time when the system was started so HA can calculate the uptime (e.g. "2 days ago")

@laszlojakab
Copy link
Author

You are right it is enough to set it in birth mqtt message.

proddy added a commit to proddy/EMS-ESP32 that referenced this issue Nov 28, 2022
proddy added a commit that referenced this issue Nov 28, 2022
#751 boot time when NTP connected
@proddy
Copy link
Contributor

proddy commented Nov 28, 2022

added boot_time

@proddy proddy closed this as completed Nov 28, 2022
proddy added a commit to proddy/EMS-ESP32 that referenced this issue Nov 29, 2022
proddy added a commit to proddy/EMS-ESP32 that referenced this issue Nov 30, 2022
proddy added a commit that referenced this issue Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants