Closed Sarnog closed 2 years ago
The addon works fine.
Post your config
log_level: info
ocr:
contrast_enhance: 2
mqtt_host: 192.168.1.31
mqtt_port: 1883
mqtt_username: '!secret mosquitto_user'
mqtt_password: '!secret mosquitto_pass'
post your automation, correctly tagged as code
This is at startup of the addon:
This is the automation in yaml:
This is the log after i run the automation:
I need the automation as code, not a screenshot ;-)
Ow sorry, hahaha...
Here it is:
alias: 'Update: Marco Best'
description: ''
trigger:
- platform: time_pattern
hours: '6'
condition: []
action:
- service: mqtt.publish
data:
topic: dgp/gas_stations
payload: '{"station_id":"4121","fuel_type":"euro95"}'
mode: single
Unfortunatly that's not working eighter.
[2022-05-24 20:28:07] INFO : Received payload '{"station_id":"4121","fuel_type":"euro95", "to_publish":1}' on topic 'dgp/gas_stations'
[2022-05-24 20:28:07] ERROR : unable to validate payload '{"station_id":"4121","fuel_type":"euro95", "to_publish":1}' for gas_stations with error: ''radius' is a required property
Failed validating 'required' in schema:
{'properties': {'friendly_name_template': {'type': 'string'},
'fuel_type': {'enum': ['euro95',
'euro98',
'diesel',
'cng',
'lpg'],
'type': 'string'},
'identifier': {'pattern': '^[a-z0-9]{0,10}$',
'type': 'string'},
'latitude': {'type': 'number'},
'longitude': {'type': 'number'},
'radius': {'maximum': 15,
'minimum': 1,
'type': 'integer'},
'to_publish': {'minimum': 1, 'type': 'integer'}},
'required': ['fuel_type', 'radius', 'longitude', 'latitude'],
'type': 'object'}
On instance:
{'fuel_type': 'euro95', 'station_id': '4121', 'to_publish': 1}'
oh, you were too fast, i deleted that post, as it was faulty...
Still, the automation code is not properly posted, like this I can't see the indentation... ;-)
can you explain to me how i can do that? Sorry for being noob-ish
No problem
Start with these signs ``` , but only 3 of them. Go to next line. Paste you automation. Go to next line. Finish with 3 of
again. Post.
The sign is on left upper corner of keyboard, next to number 1
Thank you for the explaination.. ;-) Here you are:
alias: 'Update: Marco Best'
description: ''
trigger:
- platform: time_pattern
hours: '6'
condition: []
action:
- service: mqtt.publish
data:
topic: dgp/gas_stations
payload: '{"station_id":"4121","fuel_type":"euro95", "to_publish":1}'
mode: single
You can delete the "to_publish":1 part again. It looks, like your own automation was correct, according to manual. So I'm afraid, that I would not be able to help more. As I'm more familiar with the first style of getting data described in the manuals, based on location.
I can share my automation for you, which gives 10 results in near area, you can try to edit that for your needs and see, if that works. Other ways, you will have to wait for @Skons to help you more...
alias: Update gas stations
trigger:
- platform: time_pattern
minutes: '5'
- platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: dgp/gas_stations
payload_template: >-
{"fuel_type":"euro98","radius":5,"latitude":{{
state_attr("person.mischa", "latitude") }},"longitude":{{
state_attr("person.mischa", "longitude")
}},"friendly_name_template":"[brand] ([station_street])",
"to_publish":10}
This one works flawlessly...
Only need to edit fuel type and person (you)
Yeah, that one i working correctly to me as well... Only the automation on station ID is not working and has never worked for me. But once i started the addon and checked the logs, i see that there's an error, without starting an automation. I think that error prevents the automation on the station ID to run...
Thanks for your help tho! I hope somebody understands the problem and know how to fix it.
I wish you luck! ;-)
@Skons is very friendly, he will help you soon for sure ;-)
At least, today you have learned, how to post code on GitHub and HomeAssistant forum :-)
Thanks again Mischa! i'm sure he will... ;-)
There is an empty object or '[]' object being sent to dgp/gas_stations. Is there an automation that is doing that constantly?
Another option is that while you where playing around, the retain property was set (see https://www.home-assistant.io/docs/mqtt/service/). This can be viewed with mqtt explorer (https://mqtt-explorer.com/). If that is the case the mqtt client of dgp picks up the last setting on that topic. You can delete the retained value with mqtt explorer.
According to Skons answer in the other topic, here the same fault is made, I guess?
alias: 'Update: Marco Best'
description: ''
trigger:
- platform: time_pattern
hours: '6'
condition: []
action:
- service: mqtt.publish
data:
topic: dgp/gas_station
payload: '{"station_id":"4121","fuel_type":"euro95"}'
mode: single
topic: dgp/gas_station, without the s ;-)
Yes thanks! It's working now on the station ID. The error is still there tho... I think something is wrong in this automation:
alias: 'Update: Bezinestations in de buurt'
trigger:
- platform: state
entity_id:
- input_button.update_bezinestations_omgeving
- platform: time_pattern
minutes: '15'
- platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: dgp/gas_stations
payload_template: >-
{"fuel_type":"euro95","radius":5,"latitude":{{
state_attr("person.danny",
"latitude") }},"longitude":{{ state_attr("person.danny", "longitude") }},
"friendly_name_template":"[brand] ([station_street])",
"to_publish":3}
mode: single
Maybe try single quotes around the json payload.
Solved! It was indeed a retained topic. When i deleted it with mqtt monitor, the error was gone. Thanks a lot!
Hello,
Just as i started the add-on, i received an error in the log:
Did i mess something up, or is the add-on broken?