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

add missing units of measurements for energy HA autodiscovery #4698

Merged
merged 3 commits into from
Dec 21, 2018

Conversation

reey
Copy link
Contributor

@reey reey commented Dec 20, 2018

Added a dedicated energy sensor management to report back as energy sensor and not fallback as a generic sensor in HA autodiscovery process

@ascillato
Copy link
Contributor

Cool. Thanks a lot.

Could you add also the counter sensor and the luminosity sensor please?

@reey
Copy link
Contributor Author

reey commented Dec 21, 2018

I could do that in another pull, but what do you mean by counter sensor?

@emontnemery
Copy link
Contributor

emontnemery commented Dec 21, 2018

We can do like this to get a graph in Hass for all sensors, including counters which don't have a unit:

const char HASS_DISCOVER_SENSOR_ANY[] PROGMEM =
  "%s,\"unit_of_measurement\":\" \","                        // " " As unit of measurement to get a value graph in Hass
  "\"value_template\":\"{{value_json['%s'].%s}}\"";          // "COUNTER":{"C1":0} -> {{ value_json['COUNTER'].C1 }}
const char HASS_DISCOVER_SENSOR_ANY_SHORT[] PROGMEM =
  "%s,\"unit_of_meas\":\" \","                        // " " As unit of measurement to get a value graph in Hass
  "\"val_tpl\":\"{{value_json['%s'].%s}}\"";          // "COUNTER":{"C1":0} -> {{ value_json['COUNTER'].C1 }}

@arendst arendst merged commit 2ee3e35 into arendst:development Dec 21, 2018
gemu2015 pushed a commit to gemu2015/Sonoff-Tasmota that referenced this pull request Jan 27, 2019
add missing units of measurements for energy HA autodiscovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants