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 battery_mV to rtl_433_mqtt_hass, change moisture class #2581

Closed
wants to merge 0 commits into from
Closed

Add battery_mV to rtl_433_mqtt_hass, change moisture class #2581

wants to merge 0 commits into from

Conversation

fallenpegasus
Copy link
Contributor

Moisture should be "moisture" class, not "humidity" class.
Some devices have battery_mv in addition to battery_ok.

@zuckschwerdt
Copy link
Collaborator

Thanks. We don't output battery_mv but battery_mV :)
Yes, class of moisture is valid according to https://www.home-assistant.io/integrations/sensor/ (I guess it wasn't before?)

@noahwilliamsson
Copy link
Contributor

Re: fix moisture class. I'm thinking that the "object_suffix": "H" should be changed to "object_suffix": "M". It's used when computing the MQTT publishing path. I assume it's in place to avoid name conflicts when a device has multiple sensors.

def publish_config(mqttc, topic, model, object_id, mapping, value=None):
    """Publish Home Assistant auto discovery data."""
    global discovery_timeouts

    device_type = mapping["device_type"]
    object_suffix = mapping["object_suffix"]
    object_name = "-".join([object_id, object_suffix])

    path = "/".join([args.discovery_prefix, device_type, object_id, object_name, "config"])

For reference, from https://www.home-assistant.io/integrations/sensor/#device-class

humidity: Percentage of humidity in the air in %
moisture: Percentage of water in a substance in %

@zuckschwerdt
Copy link
Collaborator

@fallenpegasus can you include the object_suffix change so we can merge this?

@zuckschwerdt zuckschwerdt changed the title Some fixes to rtl_433_mqtt_hass Add battery_mV to rtl_433_mqtt_hass, change moisture class Oct 30, 2023
@fallenpegasus
Copy link
Contributor Author

I'm going to resubmit this as two pull requests, incorporating the requested changes.

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.

3 participants