Monitor your Generac generator with Home Assistant

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 replacing value 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

  1. 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…
  2. In my main config yaml I put in the line. …packages: !include_dir_named packages
  3. 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 :slight_smile:

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…)

ok that is working great now. Thanks for your help. I only see one issue any not sure why yet…

Generator Capacity is reported as 0.0W. IT should be 22 kW. I have checked the MQTT Explorer. There is no “value” field so I did not add that onto the topic. Any reason why you think this one variable is not reporting correctly? I have double checked for typos.

Good question; mine shows zero too! And looking at my longer-term storage of data that I shove into influxdb, it looks like it has been reporting zero since last June, when it reported the expected 22kw. I wonder what might have changed back then…? Hmmm…

Ok, it seems like the “KW” units changed to “kW” somewhere along the way. And also, it’s strange that this value returns 20 kW now, even though my generator is a 22 kW unit. However the related generator/Maintenance/Controller Settings/Rated Max Power topic reports 22 kW.

To make the parsing of that topic value work, change the value template to a somewhat more flexible pattern that looks like this:

   value_template: '{{ value | regex_replace(" *[Kk]W", "") | float * 1000 | round(1) }}'

This will match zero or more spaces and then either lower case or upper case “K”. A different issue is why these two numbers are reported differently…

After the edit mine now reports 22,000.0 W… which is correct

I also edited the value and removed the *1000 and changed the unit to kW… It now reports 22.0 kW

I deliberately chose to normalize the value to watts, since Home Assistant has a well-known “unit of measurement” in watts. This has some downstream implications for me, at least, since I use the influxdb component to feed a bunch of entities into the influxdb time series database. In that DB, power is normalized as “W” units.

If all you’re using that for is a cosmetic display, it likely doesn’t matter at all. Just thought I’d pass along the rationale.

I poked around, and it looks like that number comes from a configuration value that’s initially set up during installation when genmon does a serial number lookup to find out what kind of generator you have. I just looked up my model number on the generac site, and it comes up as a 22kW unit. I’ll see if I can figure out the serial number result. Just curious…

I added a few more entities, including fetching the generator run time (in hours). I updated the very first post of this thread with the current version of my YAML configuration. Hopefully this will also avoid those new to all this from going down the original path of using the REST-based sensors I used initially.

Hi just wondering the status of this project since the thread hasnt been updated in almost a year. I just ordered a 26kw standby generator (have to wait 6 months im told!) and was hoping there was an integration for it. Was disappointed there wasnt esspecially since I saw kohler was added in the last update. (I really hope i made the right decision going with generac over kohler!) Hoping this still works! I’m assuming I am getting the wifi link system because I was told i am getting one that doesnt have a monthly fee.

Look at the GitHub link in the very first post.
Development is still active.
I only have a little 22KW Generator compared to your 26. So yours will be liquid cooled.
You will have to look to see if your model is supported. I know Generac made a firmware ‘update’ that tried to disable 3rd party products, I think this has been overcome. I would not get a generator with a cell transmitter built in, this give you no protection from forced updates.