I suggest you explore the Utility Meter integration. You can create a Utility Meter Sensor with cycle: daily
to monitor sensor.total_rain
.
utility_meter:
rain_daily:
source: sensor.total_rain
cycle: daily
I suggest you explore the Utility Meter integration. You can create a Utility Meter Sensor with cycle: daily
to monitor sensor.total_rain
.
utility_meter:
rain_daily:
source: sensor.total_rain
cycle: daily
I have a final question:
I recieve km/h on the windsensor and want to have it in m/s.
I guess i can use the Template sensor in some way.
Im not sure how to define(Still learning)
I want to have the new value in a new sensor if its suitable, but if its better to adjust the existing, thats OK,
Divide the speed in km/h by 3.6 to get m/s. Round the result to 2 decimal places.
For example:
- name: 'Average_Speed'
unique_id: 'Average_Speed'
state_topic: 'oregon/wind/AvgSpeed'
unit_of_measurement: 'm/s'
value_template: '{{ (value_json.AvgSpeed / 3.6) | round(2) }}'
@123 This solution have worked for 8 month now=), but now im getting the error “Error executing script. Service not found for call_service at pos 1: Unable to find service mqtt.publish”
Have the command “call for service” mqqt.publish been taken away from Home assistant?
The mqtt.publish
service call is still available.
Ensure you still have the MQTT integration installed and configured properly. Without it, MQTT-related services will not be present.
When running mqtt publish, my HA says “Error rendering data template: UndefinedError: ‘trigger’ is undefined”
In my previous post, I asked that you “ensure you have the MQTT integration installed and configured properly”. What did you do to confirm it’s present and working?
You’ll get that if you attempted to test the automation by executing its Run command.
Reference: Testing your automation
I can see that my MQTT recieves data from the broker, but they dont show in my sensor in home assistant. im using the same code that you sent me.
My actual conig in configuration.yaml:
mqtt:
sensor:
- name: ‘Average_Speed’
unique_id: ‘Average_Speed’
state_topic: ‘oregon/wind/AvgSpeed’
unit_of_measurement: ‘m/s’
value_template: ‘{{ (value_json.AvgSpeed / 3.6) | round(2) }}’
- name: 'Gust_Speed'
unique_id: 'Gust_Speed'
state_topic: 'oregon/wind/GustSpeed'
unit_of_measurement: 'm/s'
value_template: '{{ (value_json.GustSpeed / 3.6) | round(2) }}'
- name: 'Direction'
unique_id: 'Direction'
state_topic: 'oregon/wind/Direction'
value_template: >
{% set directions =
{ 12: 'Norr',
35: 'Norr Norr Öst',
57: 'Norr Öst',
80: 'Öst Norr Öst',
102: 'Öst',
125: 'Öst Syd Öst',
147: 'Syd Öst',
170: 'Syd Syd Öst',
192: 'Syd',
215: 'Syd Syd Väst',
237: 'Syd Väst',
260: 'Väst Syd Väst',
282: 'Väst',
305: 'Väst Norr Väst',
327: 'Norr Väst',
349: 'Norr Norr Väst',
360: 'Norr' } %}
{{ directions.get(directions.keys() | select('>', value_json.Direction | int(0)) | first, 'Unknown') }}
- name: 'Current_Rain'
unique_id: 'Current_Rain'
state_topic: 'oregon/rain/CurrentRain'
unit_of_measurement: 'mm/h'
value_template: '{{ value_json.CurrentRain }}'
- name: 'Total_Rain'
unique_id: 'Total_Rain'
state_topic: 'oregon/rain/CurrentTRain'
unit_of_measurement: 'mm'
value_template: '{{ value_json.CurrentTRain }}'
Here is my automation for the values to the sensor.
alias: Auto-värden till vädersensornerna.
trigger:
I have checked the ids of the units from Vera and its correct , 2880 and 3050
@123 I get these error in my HA logs:
Auto-värden till vädersensornerna.: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
Error while executing automation automation.skapa_unika_varden_till_vadersensornerna_2: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
Looks like something wrong in the automation.
If you attempted to test the automation by manually triggering it, using the Run command, you will get those errors. The trigger
variable doesn’t exist when you manually trigger the automation. Therefore all of these will be undefined:
trigger.id
trigger.payload_json.Variable
Exactly. You can’t test an automation by manually triggering it if the automation references the trigger
variable.
@123 OK, i can see that. Im not sure why my settings doesn’t work anymore. You always give some clever hints, but I can understand that it’s hard to tell whats wrong in the settings now.
If I listen manually on oregon/# I can see that I recieve data from the MQTT-device.
I still dont get any of this information to my sensors in Home Assistant
Lyssna på ett ämne
Formatera JSON-innehåll
Lyssnar på
oregon/#
QoS
0
Meddelande 15 mottaget på oregon/rain/CurrentRain vid 0:18 :
{
“CurrentRain”: 0,
“DeviceId”: 2967,
“DeviceName”: “Regnsensor220807”,
“DeviceType”: “urn:schemas-micasaverde-com:device:RainSensor:1”,
“OldCurrentRain”: 2.03,
“RoomId”: 14,
“RoomName”: “Utomhus”,
“ServiceId”: “urn:upnp-org:serviceId:RainSensor1”,
“Time”: 1676905830,
“Variable”: “CurrentRain”
}
QoS: 0 - Retain: true
Meddelande 14 mottaget på oregon/rain/CurrentTRain vid 0:18 :
{
“CurrentTRain”: 0,
“DeviceId”: 2967,
“DeviceName”: “Regnsensor220807”,
“DeviceType”: “urn:schemas-micasaverde-com:device:RainSensor:1”,
“OldCurrentTRain”: 395.5,
“RoomId”: 14,
“RoomName”: “Utomhus”,
“ServiceId”: “urn:upnp-org:serviceId:RainSensor1”,
“Time”: 1679680954,
“Variable”: “CurrentTRain”
}
QoS: 0 - Retain: true
Meddelande 13 mottaget på oregon/wind/Direction vid 0:18 :
{
“DeviceId”: 2880,
“DeviceName”: “Vindsensor 220403”,
“DeviceType”: “urn:schemas-micasaverde-com:device:WindSensor:1”,
“Direction”: 22,
“OldDirection”: 0,
“RoomId”: 14,
“RoomName”: “Utomhus”,
“ServiceId”: “urn:upnp-org:serviceId:WindSensor1”,
“Time”: 1681404838,
“Variable”: “Direction”
}
QoS: 0 - Retain: true
Meddelande 12 mottaget på oregon/wind/GustSpeed vid 0:18 :
{
“DeviceId”: 2880,
“DeviceName”: “Vindsensor 220403”,
“DeviceType”: “urn:schemas-micasaverde-com:device:WindSensor:1”,
“GustSpeed”: 0,
“OldGustSpeed”: 3,
“RoomId”: 14,
“RoomName”: “Utomhus”,
“ServiceId”: “urn:upnp-org:serviceId:WindSensor1”,
“Time”: 1681404852,
“Variable”: “GustSpeed”
}
QoS: 0 - Retain: true
Meddelande 11 mottaget på oregon/wind/Average_Speed vid 0:18 :
45
QoS: 0 - Retain: true
Meddelande 10 mottaget på oregon/wind/AvgSpeed vid 0:18 :
{
“AvgSpeed”: 4,
“DeviceId”: 2880,
“DeviceName”: “Vindsensor 220403”,
“DeviceType”: “urn:schemas-micasaverde-com:device:WindSensor:1”,
“OldAvgSpeed”: 1.3888888888889,
“RoomId”: 14,
“RoomName”: “Utomhus”,
“ServiceId”: “urn:upnp-org:serviceId:WindSensor1”,
“Time”: 1681404852,
“Variable”: “AvgSpeed”
}
QoS: 0 - Retain: true
It must be something with the information coming on 1 line that maybe is the problem
I use the FORMAT JSON tab to get the information on multiple lines.
That means the automation is working properly because it’s receiving payloads published to the Vera/Events topic and re-publishing the to the oregon/ topic.
Any tips how to get the values updating in my units och logs? The last value updated in logs is from 13th of april. After that the values are freezed and logs empty.
What changes were made to your system on April 13th?
Battery of my rain sensor were changed because they were empty. Vera never remembered the old unit and a new unit with another ID was created. The wind sensor is still the same. I changed the ID in the oregon/-string, but both stopped to give data into the Home Assistan unit, the log atopped as well.
Can you provide more details about what you changed?
Also, post the configuration of all MQTT sensors that have stopped working.