Have you added the custom cards that are being called in the file?
I had added the following cards (I don’t think I missed any):
‘custom:config-template-card’
‘custom:button-card’
‘custom:canvas-gauge-card’
I can’t seem to locate:
‘custom:hui-vertical-stack-card’
It appears it may have been replaced with
but I can’t seem to get the correct formatting down in the YAML file.
You could probably replace it with the vertical-stack
card that is built in now.
I actually attempted to, but it still isn’t working (nor do I know if this is the actual reason it isn’t working):
entities:
- type: section
label: '${ ''Generac Evolution - Pi 3 - Raspian - Genmon '' + vars[0] }'
- type: 'custom:hui-element'
cards:
- type: horizontal-stack
cards:
- type: picture
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--ha-card-box-shadow: 'none';
}
image: /local/images/generac.png
- type: vertical-stack
cards:
- type: 'custom:button-card'
layout: icon_name_state2nd
show_icon: true
show_state: true
Through a lot of trial and error, the issue was from this line:
variables:
- 'states[''sensor.genmon_version''].state'
Glad you got it working.
Ultimately, your generator.yaml does not match @lmamakos. Can you post your generator.yaml file for comparison?
################################################################
## Package / Generator
################################################################
#
# Version 0.2
#
# (This file is used as a "package" within the Home Assistant
# configuration files. If you don't use packages with your Home
# Assistant configuration files, you need only take the relevant
# sections of this file and add them to where you define
# sensors, binary_sensors, etc.)
# This package is used to interwork with (only) Generac-brand standby
# generator systems with Nexus, Evolution and H100 controllers, also
# using the open-source "genmon" package. This package typically
# runs on a dedicated Raspberry Pi (2, 3 or Zero) and is connected
# via a serial cable to the controller located inside the generator
# cabinet. See:
# https://github.com/jgyates/genmon
# for additional information about genmon, how it works and what's
# required to implement it. Thanks very much to the author for a
# quite complete and featureful monitoring system that can send
# email, SMS notifications and many other things!
# The genmon package consists of a number of components, the primary
# one being the actual Python script that communicates with the
# generator using a ModBus protocol.
# In practice, this means running the genmon.py and genserv.py (web
# server) daemons on the Raspberry Pi connected to the generator.
# Among the optional components is a daemon which can monitor
# the generator via genmon, and publish relevant information to
# MQTT topics.
# This module implements a means to collect this data without
# requiring a custom component, or additional software that needs to
# run. This uses a number of MQTT sensors and jinga2 templates to
# receive the published data and expose them as sensor entities in
# Home Assistant.
# genmon MQTT flushes out MQTT updated every 60 seconds. You can choose
# to have MQTT sensors for any or all of these data. Note that some
# of the published data changes rather often, such as wifi RSSI,
# uptime counters, etc. You might want to configure your recorder
# component to not store those values to avoid needlessly bloating
# the recorder database with historically uninteresting data.
# note that the unique_id values in this file are not signficant (or
# even required at all). They exist so that the entities show up
# within the Home Assistant configuration GUI for customization. I
# chose to use UUIDs because it was an easy source of unique values,
# no harm would likely come from using these same values or any that
# you choose from on your own.
# Louis Mamakos <[email protected]>
# 10 Dec 2020
################################################
## Customize
################################################
homeassistant:
customize:
################################################
## Node Anchors
################################################
package.node_anchors:
customize: &customize
package: 'generator'
################################################
## generator customization
################################################
binary_sensor.genmon_power_outage:
friendly_name: 'Generator Power Outage'
sensor.genmon_outage_status:
friendly_name: 'Generator Status'
sensor.genmon_outage_utility_voltage:
friendly_name: 'Generator Utility Voltage'
sensor.genmon_generator_battery:
friendly_name: 'Generator Battery Voltage'
sensor.genmon_generator_rpm:
friendly_name: 'Generator RPM'
sensor.genmon_generator_frequency:
friendly_name: 'Generator Frequency'
sensor.genmon_generator_output_voltage:
friendly_name: 'Generator Output Voltage'
sensor.genmon_generator_output_current:
friendly_name: 'Generator Output Current'
sensor.genmon_generator_output_power:
friendly_name: 'Generator Output Power'
sensor.genmon_generator_last_alarm_log:
friendly_name: 'Generator Last Alarm'
sensor.genmon_generator_last_service_log:
friendly_name: 'Generator Last Service Log'
sensor.genmon_generator_last_action:
friendly_name: 'Generator Last Action'
sensor.genmon_generator_capacity:
friendly_name: 'Generator Capacity'
sensor.genmon_generator_exercise_time:
friendly_name: 'Generator Exercise Time'
sensor.genmon_mon_cpu_temperature:
friendly_name: 'Generator CPU Temperature'
sensor.genmon_mon_uptime:
friendly_name: 'Generator Monitor Uptime'
sensor.genmon_mon_load:
friendly_name: 'Generator Monitor Load'
sensor.genmon_outage_summary:
friendly_name: 'Generator Outage Summary'
sensor.genmon_version:
friendly_name: 'Genmon Version'
sensor.genmon_wlan_signal_level:
friendly_name: 'Genmon WLAN Signal Level'
recorder:
exclude:
entities:
- sensor.genmon_mon_cpu_temperature_raw
- sensor.genmon_mon_uptime
################################################
## generator sensors
################################################
#
# The MQTT topics need to match what's transmitted by the
# genmon host. I use a non-standard MQTT prefix of '19916/' to
# conform with the convention that I happen to use with my own
# home automation system.
#
sensor:
- platform: mqtt
unique_id: "fd8f8c07-7d6f-4aea-92b5-16b7d8acc66b"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
state_topic: 'mygen/generator/Outage/Status'
name: Genmon Outage Status
- platform: mqtt
unique_id: "f565fed6-8a19-49d4-8066-4015c5ca91b1"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
state_topic: 'mygen/generator/Outage/Utility Voltage/value'
name: Genmon Outage Utility Voltage
value_template: '{{ value | regex_replace(" V", "") | float | round(0) }}'
unit_of_measurement: "VAC"
# status related sensors
- platform: mqtt
unique_id: "713eb4b9-feec-4425-8c83-84a9f486aae7"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Battery Raw
state_topic: 'mygen/generator/Status/Engine/Battery Voltage/value'
unit_of_measurement: "V"
value_template: '{{ value | regex_replace(" V", "") | float | round(1) }}'
- platform: filter
name: Genmon Generator Battery
entity_id: sensor.genmon_generator_battery_raw
filters:
- filter: time_throttle
window_size: "00:15"
- platform: mqtt
unique_id: "f3a8aedd-206b-4e5f-baa9-677496ee8d3c"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator RPM
unit_of_measurement: "RPM"
state_topic: 'mygen/generator/Status/Engine/RPM/value'
value_template: '{{ value | int }}'
- platform: mqtt
unique_id: "cbdc9c28-5748-4aef-91bc-5b5ec95ed545"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Frequency
unit_of_measurement: "HZ"
state_topic: 'mygen/generator/Status/Engine/Frequency/value'
value_template: '{{ value | regex_replace(" Hz","") | float }}'
- platform: mqtt
unique_id: "f5f462db-e16d-4596-9bd3-232b70fa5038"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Output Voltage
unit_of_measurement: "VAC"
state_topic: 'mygen/generator/Status/Engine/Output Voltage/value'
value_template: '{{ value | regex_replace(" V","") | float | round(1) }}'
# current measrement is garbage on 22KW product, apparently
- platform: mqtt
unique_id: "10e1def6-35fd-4922-932a-90f25abb7f29"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Output Current
unit_of_measurement: "A"
state_topic: 'mygen/generator/Status/Engine/Output Current/value'
value_template: '{{ value | regex_replace(" A","") | float | round(1) }}'
- platform: mqtt
unique_id: "914a4e97-54a0-41e7-bbeb-a256134e5e35"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Output Power
unit_of_measurement: "W"
state_topic: 'mygen/generator/Status/Engine/Output Power (Single Phase)/value'
# this is normalized to watts from kilowatts
value_template: '{{ value | regex_replace(" kW","") | float * 1000 | round(0) }}'
- platform: mqtt
unique_id: "8cb64471-9123-48f6-b9be-15c01595981e"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Last Alarm Log
state_topic: 'mygen/generator/Status/Last Log Entries/Logs/Alarm Log'
- platform: mqtt
unique_id: "bce3182a-a525-47dc-937c-8be4e5afc619"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Last Service Log
state_topic: 'mygen/generator/Status/Last Log Entries/Logs/Service Log'
- platform: mqtt
unique_id: "bf48e972-0b96-489a-9eee-4f2030017c3f"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Last Action
state_topic: 'mygen/generator/Status/Last Log Entries/Logs/Run Log'
# maint related sensors
- platform: mqtt
unique_id: "bf7cbe92-2b1e-48ca-addd-df963697626c"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Capacity
state_topic: 'mygen/generator/Maintenance/Rated kW'
# normalize to watts
value_template: '{{ value | regex_replace(" kW", "") | float * 1000 }}'
#value_template: '{{ value | float * 1000 | round(1) }}'
unit_of_measurement: 'W'
- platform: mqtt
unique_id: "825657b6-c67a-427a-bee9-7b6ea2182628"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Generator Exercise Time
state_topic: 'mygen/generator/Maintenance/Exercise/Exercise Time'
# might be nice to maybe somehow normalize this, but not sure into what date/time representation
# value is something like: "Weekly Sunday 17:35 Quiet Mode On"
# genmon monitor related sensors
- platform: mqtt
unique_id: "792c8096-84a3-4870-ac23-8cc5dcc8f8f0"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Mon CPU Temperature Raw
unit_of_measurement: "F"
device_class: temperature
state_topic: 'mygen/generator/Monitor/Platform Stats/CPU Temperature'
value_template: '{{ value | regex_replace("F","") | float | round(0) }}'
- platform: mqtt
unique_id: "825657b6-c67a-427a-bee9-7b6ea2181001"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Version
state_topic: 'mygen/generator/Monitor/Generator Monitor Stats/Generator Monitor Version'
# might be nice to maybe somehow normalize this, but not sure into what date/time representation
# value is something like: "Weekly Sunday 17:35 Quiet Mode On"
- platform: filter
name: Genmon Mon CPU Temperature
entity_id: sensor.genmon_mon_cpu_temperature_raw
filters:
- filter: time_throttle
window_size: "00:10"
- platform: mqtt
unique_id: "7c398cb0-43bf-469b-b49f-ae8b526cac32"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Mon Uptime
# maybe parse this out into minutes/hours?
state_topic: 'mygen/generator/Monitor/Platform Stats/System Uptime'
- platform: mqtt
unique_id: "60b44a17-2535-47da-af10-7f6b45d35d3a"
expire_after: 300 # genmon MQTT flushes out MQTT updated every 60 seconds
name: Genmon Mon Load
unit_of_measurement: '%'
state_topic: 'mygen/generator/Monitor/Platform Stats/CPU Utilization'
value_template: '{{ value | regex_replace(" *%","") | float | round(1) }}'
- platform: mqtt
state_topic: "mygen/generator/Monitor/Platform Stats/WLAN Signal Level"
name: "Genmon WLAN Signal Level"
value_template: '{{ value | regex_replace(" dBm", "") | float | round(1) }}'
unit_of_measurement: dBm
device_class: signal_strength
# note that these following sensors are unique to my own specific situation and
# are values collected from 1-wire bus temperature sensors connected to the Raspberry
# Pi running genmon. These do not come from the standard generator controller or
# the on-board temperature sensor in the Raspberry Pi ARM CPU. You should omit
# these sensors if you're adapting my file for your own purposes.
# - platform: mqtt
# unique_id: "882cb971-bf3e-4281-a158-bf0d0e3eb4ea"
# expire_after: 600
# name: Genmon 1W Controller Box
# unit_of_measurement: F
# state_topic: 'mygen/generator/Status/External Temperature Sensors/28-00000bc56fa5'
# value_template: '{{ value | regex_replace(" *F", "") | float | round(1) }}'
# - platform: mqtt
# unique_id: "1f54deef-b168-431a-aa9d-2af8e1fbf2c7"
# expire_after: 600
# name: Genmon 1W Outside Air
# unit_of_measurement: F
# state_topic: 'mygen/generator/Status/External Temperature Sensors/28-020a91770670'
# value_template: '{{ value | regex_replace(" *F", "") | float | round(1) }}'
# - platform: mqtt
# unique_id: "8ca45d5e-91fb-4826-bc75-ea1b3d8046c4"
# expire_after: 600
# name: Genmon TC Generator Body
# unit_of_measurement: F
# state_topic: 'mygen/generator/Status/External Temperature Sensors/3b-6d800cc77f01'
# value_template: '{{ value | regex_replace(" *F", "") | float | round(1) }}'
# - platform: mqtt
# unique_id: "545c8624-4428-4791-ba95-df671b74aafe"
# expire_after: 600
# name: Genmon TC Oil Cooler
# unit_of_measurement: F
# state_topic: 'mygen/generator/Status/External Temperature Sensors/3b-4c880b6ac367'
# value_template: '{{ value | regex_replace(" *F", "") | float | round(1) }}'
# - platform: mqtt
# unique_id: "d6f20e32-04bf-4155-842f-d68346e3a68b"
# expire_after: 600
# name: Genmon TC Engine Body
# unit_of_measurement: F
# state_topic: 'mygen/generator/Status/External Temperature Sensors/3b-4c880b6ac389'
# value_template: '{{ value | regex_replace(" *F", "") | float | round(1) }}'
- platform: template
sensors:
generator_outage_summary:
# entity_id:
# - sensor.genmon_outage_status
unique_id: "11be76cc-02bc-4868-b033-5efc60a289c5"
value_template: >-
{% if states.sensor.genmon_outage_status.state | regex_match('System in outage') %}
{% set duration = (as_timestamp(now()) - as_timestamp(states.sensor.genmon_outage_status.state)) | regex_replace('System in outage since ') | int %}
{% set hours = duration // 3600 %}
{% set duration = duration - hours * 3600 %}
{% set minutes = duration // 60 %}
{% set seconds = duration % 60 %}
Outage active for {{ '%d:%02d:%02d' | format(hours, minutes, seconds) }}
{% else %}
{{ states.sensor.genmon_outage_status.state }}
{% endif %}
#
# probably the most useful sensor - are we in a power outage condition or not?
#
binary_sensor:
- platform: mqtt
unique_id: "468414df-32b1-4127-8636-4202a11b880c"
name: Genmon Power Outage
state_topic: 'mygen/generator/Outage/System In Outage'
payload_on: 'Yes'
payload_off: 'No'
group:
generator_stats:
name: generator
entities:
- binary_sensor.genmon_power_outage
- sensor.genmon_outage_status
- sensor.genmon_outage_utility_voltage
- sensor.genmon_generator_battery
- sensor.genmon_generator_rpm
- sensor.genmon_generator_frequency
- sensor.genmon_generator_output_voltage
- sensor.genmon_generator_output_current
- sensor.genmon_generator_output_power
- sensor.genmon_generator_last_alarm_log
- sensor.genmon_generator_last_service_log
- sensor.genmon_generator_last_action
- sensor.genmon_generator_capacity
- sensor.genmon_generator_exercise_time
- sensor.genmon_mon_cpu_temperature
- sensor.genmon_mon_uptime
- sensor.genmon_mon_load
- sensor.genmon_version
# - sensor.power_volts
# - sensor.power_total
automation:
# - alias: 'start power outage'
# initial_state: 'on'
# trigger:
# - platform: state
# entity_id: binary_sensor.genmon_power_outage
# from: 'off'
# to: 'on'
# # so ideally wait a little bit for the generator to time out the utility power
# # loss, start and operate the automatic transfer switch from utility to generator
# # network equipment should be a UPS.. hopefully ISP connectivity is still working
# for:
# seconds: 45
# action:
# - service: notify.pushover_louie
# data:
# message: "Utiliy Power Loss at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
# title: "HASS"
# maybe also initiate a zwave heal network or something after power is restored to
# from standby generator after a ~45 second interruption? Switch back is pretty
# quick, with only a couple hundred millisecond transfer time in the ATS..
#
# - alias: end power outage
# initial_state: true
# trigger:
# - platform: state
# entity_id: binary_sensor.genmon_power_outage
# from: 'on'
# to: 'off'
# action:
# - service: notify.pushover_louie
# data:
# message: "Transfer back to utiliy power at {{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
# title: "HASS"
############################################################################3
#
# Fun facts (For 22kw generac model)
#
# Per specification, fuel consumption for propane is
# 2.56 gal/hr at 50% load (11KW)
# 3.87 gal/hr at 100% load (22KW)
#
# Per genmon code, the 3 term polynomial to compute this is: [0, 2.74, 1.16]
#
# gal/hr = (T0 * pctLoad^2) + (T1 * pctLoad) + T3
# gal/hr = 2.74 * pctLoad + 1.16
#
# This is a pretty good fit to the spec sheet -
# 50% = 2.53 gal/hr (vs 2.56 spec)
# 100% = 3.90 gal/hr (vs 3.87 spec)
#
# Home assistant could compute a gallons/hour rate in a te
Thanks for posting that.
I have everything set up but I am not getting values for many of the topics…(see pic). I know if is communicating because I am getting the Generator Status ad Power etc. I stripped out the 19916/. Also included is MQTT Explorer and I can see the topics/. On genmon I have JSON number as numeric selected…Does that matter? I also tried spaces removed on and off but there was no difference. Any help/suggestions appreciated.
It’s difficult to tell what’s going on because MQTT Explorer is “helping” too much.
What my configuration does is look for individual values published to unique topics, rather than some JSON aggregate. The template expressions will remove the optional units if they are present.
This thread is really rather long; about 3 weeks ago I posted a snapshot of my most recent Home Assistant configuration for processing the genmon MQTT messages. You might take a look at it to make sure you’re starting from the same place.
In genmon, my MQTT add-on configuration looks like this:
You probably want to leave the “Root Topic” blank, the default value as you’ve removed this prefix. You might try turning off “JSON for Numerics” and see if that help; my belief is that the templates will work either way, but I’ve not tested that in quite a while.
My root topic is blank. I tried with Jason for numeric turned off but still did not get any values. Yes I am using your version 0.2 of the packages yaml. I will need to look more specifically at the command to get the values and see what is occurring there. I have doubled checked the topics and they are correct. I have my genmon sending values to another system so prefer to leave Josn for numeric so turned on. Any other thoughts how to strip out the values?
Is your “flush interval” set smaller than the expire_after
interval in the configuration? I wonder if you have values that don’t change and expire?
Let me look at some of the template expressions and convince myself they still work if the units are missing…
Flush interval set to 60
I tried a few of the template expressions with values that have the units missing, and they do continue to work; not matching the pattern isn’t an error.
(I did notice that I forgot to do this for the generator capacity value, so I’ve fixed that…)
My suggestions at this point are:
-
check the flush interval thing as I previously mentioned. Genmon won’t send value that haven’t changed very recently often enough for Home Assistant to declare them unavailable.
-
You might try to subscribe to
generator/#
in Configuration>Intergrations>MQTT>Configure>Listen to a Topic and see if the topics and text match what you’re expecting. You can always verify what the template sensors are doing by going into Developer Tools > Template and testing the template expression in there. Just copy the text from the MQTT listen thing, enclose it in quotes and then invoke the template by replacingvalue
with the quoted string.
So
value_template: '{{ value | regex_replace(" kW","") | float * 1000 | round(0) }}'
from one of the template sensors would get tested in the Template developer tool as
{{ "22 kW" | regex_replace(" kW","") | float * 1000 | round(0) }}
if 22 kW
was the payload.
Seems like there’s a plumbing problem somewhere; could you try to capture the raw MQTT messages going by so we can see what they look like?
If the MQTT listen thing in Home Assistant is unwieldy, I built a simple python script to monitor MQTT traffic, as described in this post that might be helpful. (You can ignore the bit about the retained messages.)
When I enter the subscribe pic not Matt I see all the topics go by with various appropriate values 12.9,then 242…then etc.
I copied and pasted your yaml so I know there is not a typo.
Just to be sure here is the install I did
- Created package folder and installed the generator.yaml file in that folder. (I them removed the 19916/ from each entry. I left the rest the same including th unique id etc…
- In my main config yaml I put in the line. …packages: !include_dir_named packages
- The entities should show up automatically
I am using Matt for other things such as my pentair pool and it is receiving valves fine.
Not sure if I used the Developed template correctly but everything returns a 0.0 when I past the value_… in quotes.
When I look at the entities which are unavailable I get the following message…
This entity (“sensor.genmon_mon_cpu_temperature”) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.
Do I need to change the unique ID in the generator.yaml file?
OK Here is some updated info.
When I turn JSON for numerics off and restart the genmon and restart the home assistant. I start to get values for all the sensors.
When I turn JSON for numerics on and restart genmon and restart home assistant then I get all sensors except the ones with “text” as unavailable.
When I look under Config-integration-mqtt-config and subscribe I see the values without units (JSON on for numerics) and I see the values with units of JSON for numerics off. It seems to indicate that the template expressions are not working when JSON for numerics is on???
Th
It sounds like it. Let me flip the configuration on my genmon instance and see exactly what gets published. I’m sure this will somehow provoke a power failure in my area
Ok, I see what’s going on here. I misunderstood what that switch does; I thought it only removed the units from the published value to the topic. But instead, it publishes to a set of different topics like this:
[2021-05-17 22:30:59] 19916/generator/Status/Line/Utility Voltage/type: int
[2021-05-17 22:30:59] 19916/generator/Status/Line/Utility Voltage/value: 249
[2021-05-17 22:30:59] 19916/generator/Status/Line/Utility Voltage/unit: V
Rather than just the topic 19916/generator/Status/Line/Utility Voltage: 249
So I think the answer is to modify the topic subscriptions for those numeric items that don’t show up and add the /value
suffix to the topic.
I believe this is only necessary for a subset of the topics in the Status
, Maintenance
and Outage
group of values.
@farberm , taking a look, I think these topics will need to be modified to add the /value
suffix. I added these lines (commented out) in my configuration. I’d be interested to see if this resolves the problem when you have the JSON Numerics switch turned on.
# state_topic: '19916/generator/Outage/Utility Voltage/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/Battery Voltage/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/RPM/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/Frequency/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/Output Voltage/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/Output Current/value' # if JSON numerics
# state_topic: '19916/generator/Status/Engine/Output Power (Single Phase)/value' # if JSON numerics
(removing the 19916/ prefix for your situation…)