JSON output option for Home Assistant Text Sensor #3289
Unanswered
philpem
asked this question in
Component enhancements
Replies: 1 comment 1 reply
-
I could be wrong, but I have a feeling that any integration that is actually merged into HA would not expose the attributes directly as python objects like that. Can you reproduce this with any built-in integration? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
text_sensor, homeassistant platform
Link to component documentation on our website
https://esphome.io/components/text_sensor/homeassistant/
Describe the enhancement
Currently if a complex attribute is passed in (one represented as Python dicts, lists and objects) the Text Sensor will send a Python-syntax string representation from Home Assistant to the ESPHome device. This is hard to deserialise in ESPhome and involves either string replacements to convert the code to JSON, or writing a parser from scratch.
It would be nice to have an option for the Home Assistant Text Sensor so that objects like this could be represented as JSON, e.g.:
Use cases
This would allow me to more easily pull the data from the Octopus Energy Integration (https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/electricity/#current-day-rates) into the ESP32 which runs my solar energy system.
I'd like to use this data to optimise the charging of the battery from grid, to charge the battery when energy is cheap and prevent charging during expensive peak periods.
(My inverter doesn't integrate with my energy supplier so I'm having to write this myself)
Anything else?
Octopus Energy integration: https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy
Details of the current day rates data format: https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/electricity/#current-day-rates
Shortened example of the data the Text Sensor currently sends to the ESPHome device:
(Redacted content is my electricity meter's serial number)
Beta Was this translation helpful? Give feedback.
All reactions