Hi

On my Pi4 I have data from weewx and data from my solar and power/water 
consumption monitoring system combined to a single MQTT stream and this is 
used within HAAS.

I also had some issues but I have included here my relevant part of my 
config yaml.....Note the MQTT section hope this helps...I am running the 
latest HAAS on my Pi.

Neville

# Actron aircon information
rest:
  - resource: http://192.168.0.51/6.json
    sensor:
      - name: "InsideTemp_AC"
        value_template: "{{ (value_json.roomTemp_oC) }}"
        unit_of_measurement: "°C"
        unique_id: actronTemp
        
      - name: "AirConSetTemp"
        value_template: "{{ (value_json.setPoint) }}"
        unit_of_measurement: "°C"
        unique_id: actronSetTemp

      - name: "AirconRunning"
        value_template: "{{  (value_json.isOn) }}"
        unique_id: actronrunning

      - name: "AirconFanSpeed"
        value_template: "{{  (value_json.fanSpeed) }}"
        unique_id: actronfanspeed

template:
  - sensor:
      - name: "Grid Supplied power calculated"
        device_class: power
        unit_of_measurement: "W"
        state: >
          {% set grid_production = states('sensor.metern_solar') | float(0) 
%}
          {% set grid_consumption = states('sensor.metern_power') | 
float(0) %}
            {% if (grid_consumption - grid_production) < 0 %}
              0
            {% else %}
              {{ (grid_consumption - grid_production) }}
            {% endif %}
        unique_id: Grid_supplied
        
  - sensor:
      - name: "To Grid power calculated"
        device_class: power
        unit_of_measurement: "W"
        state: >
          {% set to_grid_production = states('sensor.metern_solar') | 
float(0) %}
          {% set to_grid_consumption = states('sensor.metern_power') | 
float(0) %}
            {% if (to_grid_production - to_grid_consumption) < 0 %}
              0
            {% else %}
              {{( to_grid_production - to_grid_consumption) }}
            {% endif %}
        unique_id: Energy_calculated_returned_to_grid
        

## These samples from meterN solar and power as well as  weewx weather 
system

mqtt:
   sensor:
   - name: "meterN power"
     state_topic: "weather/loop"
     device_class: power
     state_class: measurement
     unit_of_measurement: "W"
     value_template: "{{ (value_json.mNpowerW) }}"
     unique_id: meterN_data_power

   - name: "meterN solar"
     state_topic: "weather/loop"
     device_class: power
     state_class: measurement
     unit_of_measurement: "W"
     value_template: "{{ (value_json.mNsolarW) }}"
     unique_id: meterN_data_solar
     
   - name: "meterN Water usage"
     state_topic: "weather/loop"
     device_class: water
     state_class: total_increasing
     unit_of_measurement: "L"
     value_template: "{{ (value_json.water5min) }}"
     unique_id: MeterN_data_water
     
   - name: "Outside Temperature"
     state_topic: "weather/loop"
     unit_of_measurement: "°C"
     value_template: "{{ (value_json.outTemp_C | round(1)) }}"
     unique_id: Outside temperature deg C
     
   - name: "Outside Humidity"
     state_topic: "weather/loop"
     unit_of_measurement: "%"
     value_template: "{{ (value_json.outHumidity | round(1)) }}"
     unique_id: Outside Humidity percentage
     
   - name: "Air pressure"
     state_topic: "weather/loop"
     unit_of_measurement: "hPa"
     value_template: "{{ (value_json.pressure_mbar | round(2)) }}"
     unique_id: Atmospheric air pressure
     
   - name: "Lounge Temperature"
     state_topic: "weather/loop"
     unit_of_measurement: "°C"
     value_template: "{{ (value_json.inTemp_C | round(1)) }}"
     unique_id: Lounge Temp
     
   - name: "Outside room Temperature"
     state_topic: "weather/loop"
     unit_of_measurement: "°C"
     value_template: "{{ (value_json.extraTemp1_C | round(1)) }}"
     unique_id: Sunroom Temp
     
#   - name: "Dining room Teperature"
#     state_topic: "weather/loop"
#     unit_of_measurement: "C"
#     value_template: "{{ (value_json.acroomtempsensor_C | round(2)) }}"
#     unique_id: Dining Room Temp
     
   - name: "FARS speed"
     state_topic: "weather/loop"
     unit_of_measurement: "rpm"
     value_template: "{{ (value_json.farsSpeed | round(2)) }}"
     unique_id: FARS fan measured speed
     

On Sunday, February 11, 2024 at 1:52:50 AM UTC+10 Claudio wrote:

> thanks for the tip, it says "Valid YAML!"
>
> Il giorno sabato 10 febbraio 2024 alle 15:14:32 UTC+1 p q ha scritto:
>
>> Yaml files are really picky about formatting. You might try a checking 
>> site like yamlint.com
>>
>> On Sat, Feb 10, 2024, 3:05 AM Claudio <sche...@gmail.com> wrote:
>>
>>> Thanks Peter for your support, I will try and reinstall mosquitto to see 
>>> if I missed something along the way....
>>> what seems strange to me is that, as you can see from the photo, home 
>>> assistant is able to read the topic
>>> Claudio
>>>
>>> Il giorno sabato 10 febbraio 2024 alle 12:00:14 UTC+1 Vetti52 ha scritto:
>>>
>>>> Ok, so at least weewx is uploading data to mqtt sucessfully.
>>>> The only thing, I am concerned from your listing, is the proper 
>>>> formation. But perhaps this is due to your pasting mqtt.yaml in this 
>>>> forum. 
>>>> You have hopefully placed the spaces properly, thus
>>>> sensor:               top left
>>>>   - name             two spaces indented (starts below the „n“ of 
>>>> sensor)
>>>>     unique_id and all following entries for this entity four spaces 
>>>> indented (starts below „name“)
>>>>
>>>> Otherwise I would consider reconfiguring mqtt in home assistant.
>>>>
>>>> HTH
>>>> Peter
>>>> Claudio schrieb am Samstag, 10. Februar 2024 um 11:22:31 UTC+1:
>>>>
>>>>> this is mine
>>>>>
>>>>> persistence false
>>>>>
>>>>>
>>>>> # mqtt
>>>>>
>>>>> listener 1883
>>>>>
>>>>> protocol mqtt
>>>>>
>>>>>
>>>>> # websockets
>>>>>
>>>>> listener 9001
>>>>>
>>>>> protocol websockets
>>>>>
>>>>>
>>>>> allow_anonymous true
>>>>>
>>>>> password_file /etc/mosquitto/passwd
>>>>>
>>>>>
>>>>> acl_file /etc/mosquitto/acl
>>>>> [image: Screenshot 2024-02-10 alle 08.21.14.png]
>>>>>
>>>>> Before writing here, I also followed the instructions in this post but 
>>>>> without success
>>>>> community.home-assistant.io/t/weewx-mqtt-and-how-to-import-data/212344
>>>>>
>>>>> Il giorno sabato 10 febbraio 2024 alle 11:15:17 UTC+1 Vetti52 ha 
>>>>> scritto:
>>>>>
>>>>> Well, as I am not a specialist, I can just forward my working 
>>>>> configuration, adopted from 
>>>>> community.home-assistant.io/t/weewx-mqtt-and-how-to-import-data/212344
>>>>>
>>>>> Another question is, if MQTT needs to allow anonymous access. In my 
>>>>> setup I had to allow it by creating 
>>>>> /etc/mosquitto/conf.d/anon.conf
>>>>> (or any other file.conf name) with the content
>>>>>
>>>>> listener 1883
>>>>> allow_anonymous true
>>>>>
>>>>> and restart mosquitto.
>>>>>
>>>>>
>>>>> -- 
>>> 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+...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/weewx-user/161d7523-daf6-43c5-b239-507715a6256en%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/161d7523-daf6-43c5-b239-507715a6256en%40googlegroups.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/9f1c8268-ad85-4f96-9a5a-375b0a3523b3n%40googlegroups.com.

Reply via email to