I can see that from the second screenshot you posted which contains the five MQTT Sensors. The sensor values will be updated only when a payload is received (from Vera).
Check the log for any warnings or errors that may be related to sensor.average_speed.
That’s also evident from your previous screenshot which showed three payloads published to oregon/wind/AvgSpeed and all were received almost within the same minute.
If the value of sensor.average_speed remains unchanged at zero then you should check the log for errors.
I have an idea of what might be causing the problem.
The payload received by the sensor is not handled as a JSON dictionary. That’s why you are seeing it displayed on a single line (you mentioned that in your previous post). As a consequence, the sensor’s template fails to work because it assumes the received payload is a JSON dictionary (but it isn’t)
Add the to_json filter to the automation’s service call.
After you do that, check the appearance of the payload that’s published to oregon/wind/AvgSpeed. It should appear on multiple lines as opposed to a single line. It should be identical to the payload published to Vera/Events/2880
According to your reply via Private Message, the addition of to_json fixed the issue and it now works correctly.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.
You had also asked if there is a way for the Direction sensor to report descriptively as opposed to numerically. Here’s what I suggest:
- name: 'Direction'
unique_id: 'Direction'
state_topic: 'oregon/wind/Direction'
value_template: >
{% set directions =
{ 12: 'North',
35: 'North North East',
57: 'North East',
80: 'East North East',
102: 'East',
125: 'East South East',
147: 'South East',
170: 'South South East',
192: 'South',
215: 'South South West',
237: 'South West',
260: 'West South West',
282: 'West',
305: 'West North West',
327: 'North West',
349: 'North North West',
360: 'North' } %}
{{ directions.get(directions.keys() | select('>', value_json.Direction | int(0)) | first, 'Unknown') }}
The solution for the direction definitions worked perfect.
You are brilliant. =)
Any ideeas how to track the amount of rain/day with the currentTrain sensor.
Now it accumulates for ever. total amount.
You can see how it accumulates for ever. “CurrentTRain”: 326.8, “DeviceId”: 2879, “DeviceName”: “Regnsensor 220403”, “DeviceType”: “urn:schemas-micasaverde-com:device:RainSensor:1”, “OldCurrentTRain”: 302.4,
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,
@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?
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.
Template variable warning: ‘dict object’ has no attribute ‘id’ when rendering ‘oregon/{{ trigger.id }}/{{ trigger.payload_json.Variable }}’
Template variable error: ‘dict object’ has no attribute ‘payload_json’ when rendering ‘oregon/{{ trigger.id }}/{{ trigger.payload_json.Variable }}’
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’
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