Similarly I modify the sensors in home assistant with YAML:

################################################
#  Sensors
################################################
mqtt:
  sensor:
    - name: weewx_datetime
      state_topic: "weather/loop"
      value_template: |-
        {% if value_json.dateTime is defined  %}
          {{ value_json.dateTime | float }}
        {% endif %}

    - name: weewx_temperature
      state_topic: "weather/loop"
      unit_of_measurement: "°F"
      value_template: |-
        {% if value_json.outTemp_F is defined  %}
          {{ value_json.outTemp_F | round(1) }}
        {% endif %}


On Thu, Apr 25, 2024 at 8:53 AM Charlie Fortner <char...@rentrof.net> wrote:

> On Wed, Apr 24, 2024, at 16:15, miso k wrote
>
> I want to export MQTT messages to Home Assistant, but the numbers are too
> long.
> How can I make them shorter?
>
>
> I wouldn't do this with weewx, better to make the change in how Home
> Assistant displays the number. Via the GUI, find the device and change it's
> display precision settings. Here's an example:
>
>
>
>
> Charlie
>
> PS Sorry for the Home Assistant aside
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/f8b389a8-3d3b-4982-9967-1cd04a041190%40app.fastmail.com
> <https://groups.google.com/d/msgid/weewx-user/f8b389a8-3d3b-4982-9967-1cd04a041190%40app.fastmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CA%2Bz%2BvD5mKgWSn%2BoQYv%3DtUAJf1yCMBC8%2BjrOhCG428_mzK-bo4A%40mail.gmail.com.

Reply via email to