Coder Social home page Coder Social logo

hassio-addons's Introduction

hassio-addons

Installation

Navigate in your Home Assistant frontend to Supervisor -> Add-on Store and add this URL as an additional repository: https://github.com/Skons/hassio-addons

hassio-addons's People

Contributors

mweesenaar avatar skons avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hassio-addons's Issues

Error on install

When trying to install on my RPi 3B+, I get this error (which looks to be similar, but not quite the same as #51):

The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies tesseract-ocr tesseract-ocr-dev jpeg-dev libjpeg zlib-dev gcc libc-dev' returned a non-zero code: 3

Home Assistant 2023.7.3
Supervisor 2023.08.3
Operating System 9.5
Frontend-versie: 20230705.1 - latest

unable to validate payload

When i run the automation to update the gas price for a single station, configured like this:

image

I get this error:

ERROR   : unable to validate payload '{"station_id":4121,"fuel_type":"euro95"}' 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}'

I'm trying for days now to get it working, but i can't get it to work. I hope you can help me out.

403 Forbidden

The webservice responds with the error below. This is related to the header used.

There is currently active development in regards to scraping. The solution needs to be a bit more resillient.


<html><head><title>Apache Tomcat/7.0.76 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - Toegang geweigerd; mail naar [email protected] voor vragen</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Toegang geweigerd; mail naar [email protected] voor vragen</u></p><p><b>description</b> <u>Access to the specified resource has been forbidden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.76</h3></body></html>

Suddenly a error

Hi, I have this working configuration for a year now. Suddenly I get a error in de log
And the app is not working anymore.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... Log level is set to DEBUG [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [19:59:38] DEBUG: Requested API resource: http://supervisor/services/mqtt [19:59:38] DEBUG: Request method: GET [19:59:38] DEBUG: Request data: {} [19:59:38] DEBUG: API HTTP Response code: 400 [19:59:38] DEBUG: API Response: {"result": "error", "message": "Service not enabled"} [19:59:38] ERROR: Got unexpected response from the API: Service not enabled [19:59:38] INFO: Log_level: debug [19:59:38] INFO: mqtt_host: 192.168.86.118 [19:59:38] INFO: mqtt_port: 1883 [19:59:38] DEBUG: mqtt_username: [19:59:38] DEBUG: mqtt_password: [19:59:38] INFO: Starting dutch gas prices... INFO:dgp_common:DGP initialized, launching client INFO:dgp_common:Connecting mqtt INFO:dgp_common:Connected with result code 0

error: 'list index out of range'

When using a radius of 9 or higher, DGP gives the error 'list index out of range'.

Using the example automation with adjusted radius:

automation:
- alias: Update gas stations
  trigger:
    - platform: time_pattern
      minutes: 5 #every 5 minute past whole
  action:
  - service: mqtt.publish
    data:
      topic: 'dgp/gas_stations'
      payload_template: '{"fuel_type":"euro95","radius":9,"latitude":{{ state_attr("person.skons", "latitude") }},"longitude":{{ state_attr("person.skons", "longitude") }}, "to_publish":3}'

The logging shows:

[2023-09-28 19:43:48] INFO    : Received payload '{"fuel_type":"euro95","radius":9,"latitude":xxx,"longitude":xxx, "to_publish":5}' on topic 'dgp/gas_stations'
[2023-09-28 19:43:50] ERROR   : Unable to process station_request payload '{'fuel_type': 'euro95', 'radius': 9, 'latitude': xxx, 'longitude': xxx, 'to_publish': 5}' with error: 'list index out of range'
[2023-09-28 19:43:50] INFO    : publishing status to mqtt

Loading from a automation only Received payload

When I create a automation for loading prices every 6hours I see only a payload received in the logs. When I run it for the second times it also publish.

Automation:
{"fuel_type":"euro95","radius":5,"latitude":{{state_attr("person.robbin", "latitude") }},"longitude":{{state_attr("person.robbin", "longitude") }}, "to_publish":3, "friendly_name_template": "[brand]" }

Log:
[2022-04-21 15:51:00] INFO : Received payload '{"fuel_type":"euro95","radius":5,"latitude":52.***,"longitude":4.***, "to_publish":3, "friendly_name_template": "[brand]" }' on topic 'dgp/gas_stations'

Log Run second time:
'{"fuel_type":"euro95","radius":5,"latitude":52.***,"longitude":4***, "to_publish":3, "friendly_name_template": "[brand]" }' on topic 'dgp/gas_stations' [2022-04-21 15:56:11] INFO : There are '29' stations within range for fuel type 'euro95' [2022-04-21 15:56:11] INFO : publishing stations to mqtt [2022-04-21 15:56:11] INFO : publishing station_id 1875 to mqtt [2022-04-21 15:56:12] INFO : publishing station_id 1926 to mqtt [2022-04-21 15:56:12] INFO : publishing station_id 2180 to mqtt [2022-04-21 15:56:13] INFO : publishing stations done [2022-04-21 15:56:13] INFO : publishing status to mqtt [2022-04-21 15:56:14] INFO : publishing status done

Error on install

Trying to install and have this error:

Failed to to call /addons/f5a8083e_dutch_gas_prices/install - The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies tesseract-ocr tesseract-ocr-dev jpeg-dev libjpeg zlib-dev gcc libc-dev' returned a non-zero code: 88

Install device: Intell NUC with Homeassistant (with supervisor) perfect working in a Proxmox VM.
HA migrated from a Odroid N2+ with a working dgp. It breaks in the NUC and will not install.

Failed to install

Hi.

I get error when I install in new Hassio.
version : 2023.4.16.1

HASSIO
Home Assistant 2023.4.5
Supervisor 2023.04.0
Frontend-versie: 20230411.1 - latest

The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies tesseract-ocr tesseract-ocr-dev jpeg-dev libjpeg zlib-dev gcc libc-dev' returned a non-zero code: 85

Error "y1 must be greater than or equal to y0"

When I try and set up this plugin it does not seem to work getting the data.
Unable to process station_request payload '{'fuel_type': 'euro95', 'radius': 5, 'latitude': 53, 'longitude': 6, 'to_publish': 3}' with error: 'y1 must be greater than or equal to y0'

I have tried look in the readme's and the documentation, but no luck. Also it seems the codebase does not include those words anywhere so sadly I can't read it back and reverse figure out what is wrong. I hope you can help me.

debug Log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.3.25.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.4.2
 Home Assistant Supervisor: 2023.04.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[13:14:26] DEBUG: Requested API resource: http://supervisor/services/mqtt
[13:14:26] DEBUG: Request method: GET
[13:14:26] DEBUG: Request data: {}
[13:14:26] DEBUG: API HTTP Response code: 200
[13:14:26] DEBUG: API Response: {"result": "ok", "data": {"host": "core-mosquitto", "port": 1883, "ssl": false, "protocol": "3.1.1", "username": "addons", "password": "mea2eCoomeid8vu7shetae4aemohghiebohwahVoosiesohghix6xukaeji1cieM", "addon": "core_mosquitto"}}
[13:14:27] INFO: Log_level: debug
[13:14:27] INFO: mqtt_host: core-mosquitto
[13:14:27] INFO: mqtt_port: 1883
[13:14:27] DEBUG: mqtt_username: mqtt-user
[13:14:27] DEBUG: mqtt_password: 1234
[13:14:27] INFO: Starting dutch gas prices...
[2023-04-13 13:14:28] INFO    : DGP initialized, launching client
[2023-04-13 13:14:28] INFO    : Connecting mqtt
[2023-04-13 13:14:28] INFO    : Connected with result code 0
[2023-04-13 13:17:18] INFO    : Received payload '{"fuel_type":"euro95","radius":5,"latitude":53,"longitude":6, "to_publish":3}' on topic 'dgp/gas_stations'
[2023-04-13 13:17:18] DEBUG   : gas_station: Fuel 'euro95' new request
[2023-04-13 13:17:18] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2023-04-13 13:17:18] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places?fmt=web&fuel=euro95 HTTP/1.1" 200 None
[2023-04-13 13:17:18] DEBUG   : station: Station id '6899' new request
[2023-04-13 13:17:18] DEBUG   : Starting new HTTPS connection (1): tankservice.app-it-up.com:443
[2023-04-13 13:17:19] DEBUG   : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/6899.png HTTP/1.1" 200 None
[2023-04-13 13:17:20] ERROR   : Unable to process station_request payload '{'fuel_type': 'euro95', 'radius': 5, 'latitude': 53, 'longitude': 6, 'to_publish': 3}' with error: 'y1 must be greater than or equal to y0'
[2023-04-13 13:17:20] INFO    : publishing status to mqtt
[2023-04-13 13:17:20] DEBUG   : on_message: received the topic 'homeassistant/sensor/dgp/status/config'
[2023-04-13 13:17:21] DEBUG   : publish_status: Waiting for discovery on topic 'homeassistant/sensor/dgp/status/config'
[2023-04-13 13:17:21] DEBUG   : publish_status: Autodiscover 'True', State 'True' and Attributes 'True'
[2023-04-13 13:17:21] INFO    : publishing status done

It does that it can get the Json string of stations https://tankservice.app-it-up.com/Tankservice/v1/places?fmt=web&fuel=euro95
and the image page for the station if found also works https://tankservice.app-it-up.com/Tankservice/v1/places/6899.png
But then the bug starts I think

installatie mislukt

while installing, I get:

The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies tesseract-ocr tesseract-ocr-dev jpeg-dev libjpeg zlib-dev gcc libc-dev linux-headers libffi-dev rust cargo openssl-dev && mkdir -p /app && mkdir -p /app/cache && pip3 install Pillow && pip3 install uvicorn fastapi requests requests[socks] requests[security] fake_headers pytesseract geopy && chmod a+x /run.sh' returned a non-zero code: 17

Please advice.
Advies graag ;)

Versie | core-2021.10.6
Type installatie | Home Assistant OS
Ontwikkeling | false
Supervisor | true
Docker | true
Virtuele omgeving | false
Python-versie | 3.9.7
Besturingssysteem | Linux
Versie van het besturingssysteem | 5.10.70
CPU-architectuur | x86_64

Won't get new lpg price

It's been a while since I got the latest price.

Automation runs but there is a error in the addon log.

`s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting

Add-on: Dutch gas prices
Get gas prices from dutch gas stations

Add-on version: 2024.2.29.1
You are running the latest version of this add-on.
System: Home Assistant OS 12.1 (amd64 / generic-x86-64)
Home Assistant Core: 2024.3.1
Home Assistant Supervisor: 2024.03.0

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
Log level is set to INFO
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[23:25:26] INFO: Log_level: info
[23:25:26] INFO: mqtt_host: core-mosquitto
[23:25:26] INFO: mqtt_port: 1883
[23:25:26] INFO: Starting dutch gas prices...
[2024-03-20 23:25:27] INFO : DGP initialized, launching client
[2024-03-20 23:25:27] INFO : Connecting to mqtt host 'core-mosquitto' with clientname 'f5a8083e-dutch-gas-prices'
[2024-03-20 23:25:27] INFO : Using username 'mqtt_username' to connect to 'core-mosquitto'
[2024-03-20 23:25:27] INFO : Connected with result code '0'
[2024-03-20 23:26:17] INFO : Received payload '{"station_id":3580,"fuel_type":"lpg"}' on topic 'dgp/gas_station'
[2024-03-20 23:26:18] ERROR : _write_stationdata '3580': statuscode '403'
[2024-03-20 23:26:18] ERROR : _write_stationdata '3580': Used header '{'Accept': '/', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36 OPR/56.0.3051.99'}'
[2024-03-20 23:26:18] ERROR : _write_stationdata '3580': Used IP '62.45.117.81'
[2024-03-20 23:26:18] ERROR : _write_stationdata '3580': Response text '<title>Apache Tomcat/7.0.76 - Error report</title><style></style>

HTTP Status 403 - Toegang geweigerd; mail naar [email protected] voor vragen


type Status report

message Toegang geweigerd; mail naar [email protected] voor vragen

description Access to the specified resource has been forbidden.


Apache Tomcat/7.0.76

'
[2024-03-20 23:26:18] ERROR : _write_allstationdata: statuscode '403'
[2024-03-20 23:26:18] ERROR : _write_allstationdata: Used header '{'Accept': '/', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36 OPR/56.0.3051.99'}'
[2024-03-20 23:26:18] ERROR : _write_allstationdata: Used IP '62.45.117.81'
[2024-03-20 23:26:18] ERROR : _write_allstationdata: Response text '<title>Apache Tomcat/7.0.76 - Error report</title><style></style>

HTTP Status 403 - Toegang geweigerd; mail naar [email protected] voor vragen


type Status report

message Toegang geweigerd; mail naar [email protected] voor vragen

description Access to the specified resource has been forbidden.


Apache Tomcat/7.0.76

'
[2024-03-20 23:26:18] INFO : publishing station_id None to mqtt
Exception in thread Thread-1 (publish_station):
Traceback (most recent call last):
File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.12/threading.py", line 1010, in run
self._target(*self._args, **self.kwargs)
File "/app/mqtt_client.py", line 174, in publish_station
stationtopic = f"{station_info['station_id']}
{station_info['fuel_type']}"
~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'fuel_type'`

Access forbidden

Since several days no more updates on prices, probably after update:
No changes to HA except all updates being done without troubles

[2024-02-01 13:12:13] INFO : Using username 'addons' to connect to 'core-mosquitto'
[2024-02-01 13:12:13] INFO : Connected with result code '0'
[2024-02-01 13:12:13] INFO : Received payload '{
"fuel_type": "euro95",
"radius": 5,
"latitude": 52.xxxxxxxx,
"longitude": 4.xxxxxxx,
"to_publish": 3
}' on topic 'dgp/gas_stations'
[2024-02-01 13:12:14] ERROR : _write_allstationdata: statuscode '403'
[2024-02-01 13:12:14] ERROR : _write_allstationdata: Used header '{'Accept': '/', 'Connection': 'keep-alive', 'User-Agent': 'Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.2.2) Gecko/20100101 Firefox/60.2.2'}'
[2024-02-01 13:12:14] ERROR : _write_allstationdata: Used IP 'xxx.xxx.xxx.xxx'
[2024-02-01 13:12:14] ERROR : _write_allstationdata: Response text '<title>Apache Tomcat/7.0.76 - Error report</title><style></style>

HTTP Status 403 - Toegang geweigerd; mail naar [email protected] voor vragen


type Status report

message Toegang geweigerd; mail naar [email protected] voor vragen

description Access to the specified resource has been forbidden.


Apache Tomcat/7.0.76

'
[2024-02-01 13:12:14] INFO : There are '0' stations within range for fuel type 'euro95'

Connection Lost

When the latest version is used, the following error will appear after requesting the radius for a second time. A restart solves the problem

TRACE: homeassistant.local:51244 - HTTP connection lost

Solution:
The interaction with the current version is quite complex. I will solve this by migrating to MQTT

multiple gasstations

My "person" has no longtitude and latitude as an attribute.
But when I am at home, the entity of my "person" is in "zone.thuis" . In the payload template :
payload_template: '{"fuel_type":"euro95","radius":5,"latitude":{{ state_attr("person.skons", "latitude") }},"longitude":{{ state_attr("person.skons", "longitude") }}, "to_publish":3}'
I replaced person.skons with zone.thuis.
That does not seem to work :
In my logging : [2023-02-07 18:59:32] ERROR : Unable to process gas_stations payload '{"fuel_type":"euro95","radius":5,"latitude":None,"longitude":None, "to_publish":3}' with error: 'Expecting value: line 1 column 45 (char 44)'

When it is not possible to solve this problem, how can I add multiple stations ?
I know how to get the prices for one station, but how do I have to modify this : payload: '{"station_id":xxxx,"fuel_type":"euro95"}' to get the prices of multiple gasstations.

templates are still a struggle for me :)
Thanks in advance

Unknown error

Hi,

I'm getting the following error and don't see what's wrong.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.3.25.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (amd64 / qemux86-64)
 Home Assistant Core: 2022.12.7
 Home Assistant Supervisor: 2022.12.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[18:52:53] ERROR: Got unexpected response from the API: Service not enabled
[18:52:54] INFO: Log_level: info
[18:52:54] INFO: mqtt_host: 
[18:52:54] INFO: mqtt_port: 
[18:52:54] INFO: Starting dutch gas prices...
Traceback (most recent call last):
  File "/app/main.py", line 25, in <module>
    start(str(sys.argv[1]),str(sys.argv[2]),str(sys.argv[3])) 
IndexError: list index out of range
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Dutch Gas Prices: mqtt client lost connection

I haven't really been able to configure this addon and get it up and running because the log keeps reporting it can't connect to mqtt.
I am running the official Mosquitto broker.
(Also, I find the documentation still a bit vague, where exactly do I configure the examples given in the documentation?)

This is output from my log:


Add-on: Dutch gas prices
Get gas prices from dutch gas stations

Add-on version: 2022.1.2.1
You are running the latest version of this add-on.
System: Home Assistant OS 7.4 (armv7 / raspberrypi4)
Home Assistant Core: 2022.2.6
Home Assistant Supervisor: 2022.01.1

[2022-02-14 16:04:17] INFO : Connected with result code 5
[2022-02-14 16:04:17] ERROR : mqtt client lost connection. Will try to reconnect once in 15s.

Did I miss something, sensor unavailable

Hi,

I just noticed that my sensor no longer works.
It says unknown for 2 days.

Automation:
alias: Update gas station lpg
trigger:

  • platform: time_pattern
    minutes: 7
    action:
  • service: mqtt.publish
    data:
    topic: dgp/gas_station
    payload: "{"station_id":3580,"fuel_type":"lpg"}"

Logs:
[2023-10-19 07:07:00] INFO : Received payload '{"station_id":3580,"fuel_type":"lpg"}' on topic 'dgp/gas_station'
[2023-10-19 07:07:04] INFO : publishing station_id 3580 to mqtt
[2023-10-19 07:07:05] WARNING : Unable to find sensor with url 'http://supervisor/core/api/states/sensor.gas_station_3580_lpg', status code is '404'
[2023-10-19 07:54:01] INFO : Received payload '{"station_id":3580,"fuel_type":"lpg"}' on topic 'dgp/gas_station'
[2023-10-19 07:54:01] INFO : publishing station_id 3580 to mqtt
[2023-10-19 07:54:02] WARNING : Unable to find sensor with url 'http://supervisor/core/api/states/sensor.gas_station_3580_lpg', status code is '404'

Regards,

Jasper

Got unexpected response from the API: Service not enabled

Possibly related to #63: when starting the add-on, it stops again.

Log:


s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2024.2.29.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (armv7 / raspberrypi3)
 Home Assistant Core: 2024.2.5
 Home Assistant Supervisor: 2024.02.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
Log level is set to WARNING
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[16:41:24] ERROR: Got unexpected response from the API: Service not enabled
Traceback (most recent call last):
  File "/app/main.py", line 25, in <module>
    start(str(sys.argv[1]),str(sys.argv[2]),str(sys.argv[3]))
                               ~~~~~~~~^^^
IndexError: list index out of range
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Retrieving 3 cheapest gas stations doesn't seem to wok

Hi,
Thank you for writing this awesome addon!
| can retrieve the gas prices for a gas station id that is close by. This works great!
However, using the automation example to retrieve the three cheapest gas stations close by does not seem to work. I used a correct person entity that delivers a correct longitude and latitude, but the lowest entities are not being generated when I run the actions manually or by cron.

I tried various entities, even the device_tracker entity in the payload, but it does not seem to return anything. The debug information in the automation shows that the payload is filled correctly:

Executed: March 19, 2022, 7:41:30 PM
Result:
params:
domain: mqtt
service: publish
service_data:
topic: dgp/gas_stations
payload_template:
fuel_type: euro98
radius: 5
latitude: 51.71778965346052
longitude: 5.359328658515329
to_publish: 3
target: {}
running_script: false
limit: 10

Any idea what might be the issue here?

Automation malformed

Thanks for the new update. Much appreciated!

Setup with Mosquitto were gone fine, no any issues.

Setting up the automation give's me error: Message malformed: expected dictionary and won't save.

- alias: Update gas stations
  trigger:
    - platform: time_pattern
      minutes: 5 #every 5 minute past whole
  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") }}, "to_publish":10}'

Em I doing something wrong?

addon log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2021.11.10.1
 You are running the latest version of this add-on.
 System: Debian GNU/Linux 11 (bullseye)  (amd64 / qemux86-64)
 Home Assistant Core: 2021.11.4
 Home Assistant Supervisor: 2021.10.8
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:59:59] INFO: Log_level: info
[21:59:59] INFO: mqtt_host: core-mosquitto
[21:59:59] INFO: mqtt_port: 1883
[21:59:59] INFO: Starting dutch gas prices...
INFO:dgp_common:DGP initialized, launching client
INFO:dgp_common:Connecting mqtt
INFO:dgp_common:Connected with result code 0

request errors

[2023-04-16 11:12:05] DEBUG : Starting new HTTPS connection (2): tankservice.app-it-up.com:443
[2023-04-16 11:12:07] DEBUG : https://tankservice.app-it-up.com:443 "GET /Tankservice/v1/places/29199.png HTTP/1.1" 200 None
[2023-04-16 11:12:09] ERROR : Unable to process station_request payload '{'fuel_type': 'euro95', 'radius': 5, 'latitude': 52.xxxxx, 'longitude': 4.xxxxx, 'to_publish': 10}' with error: 'y1 must be greater than or equal to y0'
[2023-04-16 11:12:09] INFO : publishing status to mqtt
[2023-04-16 11:12:10] DEBUG : on_message: received the topic 'homeassistant/sensor/dgp/status/config'
[2023-04-16 11:12:10] DEBUG : publish_status: Waiting for discovery on topic 'homeassistant/sensor/dgp/status/config'
[2023-04-16 11:12:10] DEBUG : publish_status: Autodiscover 'True', State 'True' and Attributes 'True'
[2023-04-16 11:12:10] INFO : publishing status done

LPG, Autogas doesn't work

When pulling fuel_type lpg it gives you a error that you must use autogas, when using autogas it does the same.

[2022-03-20 17:37:23] INFO : Received payload '{"station_id":3580,"fuel_type":"autogas"}' on topic 'dgp/gas_station'
[2022-03-20 17:37:23] ERROR : Unable to process stationid '3580' with fuel_type 'autogas', error: ''autogas''

[2022-03-20 17:44:10] INFO : Received payload '{"station_id":3580,"fuel_type":"lpg"}' on topic 'dgp/gas_station'
[2022-03-20 17:44:10] ERROR : Unable to validate payload '{"station_id":3580,"fuel_type":"lpg"}' for gas_station with error: ''lpg' is not one of ['euro95', 'euro98', 'diesel', 'autogas']
Failed validating 'enum' in schema['properties']['fuel_type']:
{'enum': ['euro95', 'euro98', 'diesel', 'autogas'], 'type': 'string'}
On instance['fuel_type']:
'lpg''

Installation fail on HA Home Assistant 2023.7.1 and Debian 12 Bookworm

As HA is now compatible with Bookworm, i did the upgrade. (HA supervised, Debian, intel machine, al latest versions)

After that The DGP addon stopped working.
I got several errors. Unfortunately I did not save them.

I did choose to remove the addon, restart system and install the addon again.

Now it fails to install.

The error I get now:

The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies=20230531.221623 tesseract-ocr=5.3.1-r1 tesseract-ocr-dev=5.3.1-r1 jpeg-dev=9e-r1 libjpeg=9e-r1 zlib-dev=1.2.13-r1 gcc=12.2.1_git20220924-r10 libc-dev=0.7.2-r5' returned a non-zero code: 3

So it looks, like the addon needs to be updated for compatibility with Debian 12.

As usual, I'm standby to provide support by testing stuff and so.

Thank you very much in advance, dear @Skons , we did solve things before, we can fight this one too ;-)

Second person add for check lowest gas prices

Hi Skons,

Issue: Make a second automation with a person location to find lowest_gas_prices nearby the second person.

It will now overwrite the first person location (other automation). the Lowest_gasprice entities wil now be on the second person.

Is it possible to make an entity as followed?
sensor.gas_station_person.1_fueltype_lowest_price_1
sensor.gas_station_person.2_fueltype_lowest_price_1

Hope there's a solution.

Keep up the good work, its a good addon !

Greetz Florian

Tiende centen van benzineprijs niet getoond

Hoi :)

Leuke integratie! Ik ben hem aan het installeren en configureren in Home Assistant, alleen valt het me op dat de tienden van centen niet teruggegeven worden.

Hier in de buurt kost een liter Euro 98, 2.039 bijvoorbeeld, alleen de laatste 9 wordt niet teruggegeven in de sensor.

Heb je een tip hoe dit is op te lossen?

Dank!

Not getting the sensor entities

Installed exactly, as the manual states.

Only new entities, I get, are update sensors and the automation.

image

image

But no entities to see the gas prices.

Running on HA supervised 2021.7.2, Docker, Debian 10, all up to date.

Logs after whole day running:

image

Core log:

2021-07-16 15:55:00 ERROR (SyncWorker_6) [homeassistant.components.python_script.dutch_gas_prices.py] Error executing script: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 221, in execute
    exec(compiled.code, restricted_globals)
  File "dutch_gas_prices.py", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/RestrictedPython/Eval.py", line 35, in default_guarded_getitem
    return ob[index]
TypeError: 'NoneType' object is not subscriptable

Not getting any fuel station

I can't seem to get this to work and the manual isn't really that obvious for me either,
I checked the closed issues to see if that could point me into the right direction but it didn't in the end.
(for example: #1)

Anyway, I installed the MQTT Broker and that is running too.

My config

log_level: info
ocr:
  contrast_enhance: 2
mqtt_port: 1883
mqtt_username: homeassistant
mqtt_password: [redacted]

configuration.yaml

[redacted]
# Includes - Links to other files
[redacted]
automation: !include automations.yaml
# Sensors
sensor:
# Buienradar sensor
[redacted]
# Gas stations sensor
  - platform: rest
    name: Gas stations within radius
    scan_interval: 600
    resource_template: http://127.0.0.l:5035/api/v1/gas_stations/euro98?radius=10&longitude={{ state_attr("zone.home", "longitude") }}&latitude={{ state_attr("zone.home", "latitude") }}
    method: GET
    json_attributes:
      - gas_stations
    value_template: >
      {% if (value_json.gas_stations[0].prijs) %}
        {{ value_json.gas_stations | length }}
      {% endif %}

[redacted]

automations.yaml

[redacted]
- alias: Update gas stations
  trigger:
    - platform: time_pattern
      minutes: 5 #every 5 minute past whole
  action:
  - service: mqtt.publish
    data:
      topic: 'dgp/gas_stations'
      payload_template: '{"fuel_type":"euro95","radius":10,"latitude":{{ state_attr("person.skons", "latitude") }},"longitude":{{ state_attr("person.skons", "longitude") }}, "to_publish":3}'
- alias: 'Shell: DFlaan'
  trigger:
    - platform: time_pattern
      minutes: 5 #every 5 minute past whole
  action:
  - service: mqtt.publish
    data:
      topic: 'dgp/gas_station'
      payload: '{"station_id":4059,"fuel_type":"euro95"}'
- alias: Notify lowest price gas station
  trigger:
  - platform: state
    entity_id: sensor.gas_station_[fuel_type]_lowest_price_1
  action:
  - service: notify.mobile_app_ios
    data:
      title: Cheapest gas station
      message: 'Gas costs € {{ states.sensor.gas_station_[fuel_type]_lowest_price_1.state }} at {{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","station_street") }}. '
      data:
        url: https://www.google.com/maps/search/?api=1&query={{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","latitude") }},{{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1", "longitude") }}

The Log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.1.2.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.4  (armv7 / raspberrypi4)
 Home Assistant Core: 2022.2.6
 Home Assistant Supervisor: 2022.01.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[17:19:09] INFO: Log_level: info
[17:19:09] INFO: mqtt_host: core-mosquitto
[17:19:09] INFO: mqtt_port: 1883
[17:19:09] INFO: Starting dutch gas prices...
[2022-02-14 17:19:10] INFO    : DGP initialized, launching client
[2022-02-14 17:19:10] INFO    : Connecting mqtt
[2022-02-14 17:19:10] INFO    : Connected with result code 0
[2022-02-14 18:05:00] INFO    : Received payload on topic 'dgp/gas_stations'
[2022-02-14 18:05:00] ERROR   : Unable to process payload: 'Expecting value: line 1 column 46 (char 45)'
[2022-02-14 18:05:00] INFO    : Received payload on topic 'dgp/gas_station'
[2022-02-14 18:05:05] INFO    : publishing station_id 4059 to mqtt
[2022-02-14 18:05:06] INFO    : Status Code  = 500

I tried to follow the manual but It's not really clear to me what I'm doing wrong here.

Error on startup

Hello,

Just as i started the add-on, i received an error in the log:

ERROR   : unable to validate payload '[]' for gas_stations with error: '[] is not of type 'object'
Failed validating 'type' 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:
    []'

Did i mess something up, or is the add-on broken?

Connected with result code 5

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...

Add-on: Dutch gas prices
Get gas prices from dutch gas stations

Add-on version: 2022.3.25.1
You are running the latest version of this add-on.
System: Home Assistant OS 9.4 (amd64 / qemux86-64)
Home Assistant Core: 2022.12.9
Home Assistant Supervisor: 2022.12.1

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
Log level is set to DEBUG
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[19:32:04] DEBUG: Requested API resource: http://supervisor/services/mqtt
[19:32:04] DEBUG: Request method: GET
[19:32:04] DEBUG: Request data: {}
[19:32:04] DEBUG: API HTTP Response code: 200
[19:32:04] DEBUG: API Response: {"result": "ok", "data": {"host": "core-mosquitto", "port": 1883, "ssl": false, "protocol": "3.1.1", "username": "addons", "password": "Eivied3vaeciCauthae8aig4maiW3on4new8iesahG1leeg7opim3zouj1paiqu3", "addon": "core_mosquitto"}}
[19:32:06] INFO: Log_level: debug
[19:32:06] INFO: mqtt_host: core-mosquitto
[19:32:06] INFO: mqtt_port: 1883
[19:32:06] DEBUG: mqtt_username: null
[19:32:06] DEBUG: mqtt_password: null
[19:32:06] INFO: Starting dutch gas prices...
[2023-01-04 19:32:08] INFO : DGP initialized, launching client
[2023-01-04 19:32:08] INFO : Connecting mqtt
[2023-01-04 19:32:08] INFO : Connected with result code 5
[2023-01-04 19:32:08] ERROR : mqtt client lost connection. Will try to reconnect once in 15s.

Unable to process payload, With error ''<' not supported

Since a couple of days i'm getting the error below in my log.
This worked fine before but it stopped working for some reason

[2022-03-21 08:58:16] ERROR   : Unable to process payload '{'fuel_type': 'euro95', 'radius': 5, 'latitude': 52.509374787853304, 'longitude': 4.990115761756898, 'to_publish': 6}' with error: ''<' not supported between instances of 'NoneType' and 'float''
[2022-03-21 08:58:16] INFO    : publishing status to mqtt
[2022-03-21 08:58:16] DEBUG   : on_message: received the topic 'homeassistant/sensor/dgp/status/config'
[2022-03-21 08:58:17] DEBUG   : publish_status: Waiting for discovery on topic 'homeassistant/sensor/dgp/status/config'
[2022-03-21 08:58:17] DEBUG   : publish_status: Autodiscover 'True', State 'True' and Attributes 'True'
[2022-03-21 08:58:17] INFO    : publishing status done

Hope you can help me with this one

Unable to start plugin

Anyone else facing issues with starting the dutch gas prices addon? I cant start the plugin anymore with a fully updated HA instance.


Add-on: Dutch gas prices
Get gas prices from dutch gas stations

Add-on version: 2024.01.25.1
You are running the latest version of this add-on.
System: Home Assistant OS 11.5 (amd64 / qemux86-64)
Home Assistant Core: 2024.2.2
Home Assistant Supervisor: 2024.02.0

[16:46:38] INFO: Log_level: debug
[16:46:38] INFO: mqtt_host: XXXX
[16:46:38] INFO: mqtt_port: 1883
[16:46:38] DEBUG: mqtt_username: XXX
[16:46:38] DEBUG: mqtt_password: XXX
[16:46:38] INFO: Starting dutch gas prices...
[2024-02-21 16:46:42] DEBUG : gas_station: Cachepath is '/app/cache/'
[2024-02-21 16:46:42] INFO : DGP initialized, launching client
[2024-02-21 16:46:42] INFO : Connecting to mqtt host 'XXX' with clientname 'f5a8083e-dutch-gas-prices'
Traceback (most recent call last):
File "/app/main.py", line 23, in
start(str(sys.argv[1]),str(sys.argv[2]),str(sys.argv[3]),str(sys.argv[4]),str(sys.argv[5]))
File "/app/main.py", line 16, in start
start_mqtt_client(mqtthost,mqttport,mqttusername,mqttpassword)
File "/app/mqtt_client.py", line 394, in start_mqtt_client
mqtt_client = mqtt.Client(mqtt_client_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 766, in init
raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details

Sensors keep going into a "restored" status

Hey,

Every time I reboot my HA the sensors keep going into a restored status and don't come out of it anymore.
I've tried many different things, reboot the add-on reboot HA, restart MQTT but nothing works.
Here is some information:
image

Add-on version: 2022.2.27.1
You are running the latest version of this add-on.
System: Home Assistant OS 7.4 (amd64 / qemux86-64)
Home Assistant Core: 2022.3.4
Home Assistant Supervisor: 2022.03.3

The log from the Gas Addon

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:15:47] INFO: Log_level: info
[09:15:47] INFO: mqtt_host: core-mosquitto
[09:15:47] INFO: mqtt_port: 1883
[09:15:47] INFO: Starting dutch gas prices...
[2022-03-14 09:15:48] INFO : DGP initialized, launching client
[2022-03-14 09:15:48] INFO : Connecting mqtt
[2022-03-14 09:15:48] INFO : Connected with result code 0

And the log from the Mosquito Broker

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] mosquitto.sh: executing...
[09:14:54] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing...
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[09:14:54] INFO: Starting NGINX for authentication handling...
[09:14:54] INFO: Starting mosquitto MQTT broker...
1647245694: mosquitto version 1.6.12 starting
1647245694: |-- *** auth-plug: startup
[09:14:55] INFO: Successfully send discovery information to Home Assistant.
[09:14:55] INFO: Successfully send service information to the Supervisor.
1647245694: Config loaded from /etc/mosquitto/mosquitto.conf.
1647245694: Loading plugin: /usr/share/mosquitto/auth-plug.so
1647245694: ├── Username/password checking enabled.
1647245694: ├── TLS-PSK checking enabled.
1647245694: └── Extended authentication not enabled.
1647245694: Opening ipv4 listen socket on port 1883.
1647245694: Opening ipv6 listen socket on port 1883.
1647245694: Opening websockets listen socket on port 1884.
1647245694: Warning: Mosquitto should not be run as root/administrator.
1647245694: mosquitto version 1.6.12 running
1647245694: New connection from 127.0.0.1 on port 1883.
1647245694: Socket error on client , disconnecting.
1647245696: New connection from 172.30.32.1 on port 1883.
1647245696: New client connected from 172.30.32.1 as 2IkAjgcfOXPohSQE6rPL1d (p2, c1, k60, u'homeassistant').
1647245707: New connection from 172.30.33.8 on port 1883.
1647245708: Socket error on client , disconnecting.

Hope you can help me out fix this issue once and for all.

invalid config for automation

-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.1.2.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.4  (armv7 / raspberrypi4)
 Home Assistant Core: 2022.2.7
 Home Assistant Supervisor: 2022.01.1
-----------------------------------------------------------

My Home assistant log shows the following:

2022-02-16 13:33:36 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: template value should be a string for dictionary value @ data['action'][0]['data']. Got None. (See /config/configuration.yaml, line 16).

This leads to the automation.yaml file.
I removed every single automation and the log still pops up.
It seems that the error is caused by something in the following code from the automation.yaml file

- alias: Update gas stations
  trigger:
  - platform: time_pattern
    minutes: 5
  action:
  - service: mqtt.publish
    data:
      topic: dgp/gas_stations
      payload_template: '{"fuel_type":"euro95","radius":10,"latitude":{{ state_attr("person.[redacted]",
        "latitude") }},"longitude":{{ state_attr("person.[redacted]", "longitude")
        }},"friendly_name_template":"[brand] ([station_street])", "to_publish":5}'
- alias: Notify lowest price gas station
  trigger:
  - platform: state
    entity_id: sensor.gas_station_[fuel_type]_lowest_price_1
  action:
  - service: notify.mobile_app_IphoneP
    data:
      title: Cheapest gas station
      message: 'Gas costs € {{ states.sensor.gas_station_[fuel_type]_lowest_price_1.state
        }} at {{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","station_street")
        }}. '
      data:
        url: https://www.google.com/maps/search/?api=1&query={{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","latitude")
          }},{{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1", "longitude")
          }}
  id: [redacted]
  

Unfortunately, the mobile app notification doesn't seem to work either, this could be related.
(It works if I create an automation through the GUI)

Group not correctly created

The group created by the python script is not correctly formed.

Using entities['entity_id'] instead of entities['entities'] fixed this.

error on install

Trying to install and have this error:

The command '/bin/bash -o pipefail -c apk add --no-cache --virtual .build-dependencies=20230531.221623 tesseract-ocr=5.3.1-r1 tesseract-ocr-dev=5.3.1-r1 jpeg-dev=9e-r1 libjpeg=9e-r1 zlib-dev=1.2.13-r1 gcc=12.2.1_git20220924-r10 libc-dev=0.7.2-r5' returned a non-zero code: 91

Home Assistant 2023.7.3
Supervisor 2023.07.1
Operating System 10.3
Frontend-versie: 20230705.1 - latest

'Gas stations based on id' seems to report 'Unknown'

Running an automation with

service: mqtt.publish
data:
  topic: dgp/gas_station
  payload_template: "{\"fuel_type\":\"euro95\", \"station_id\":6323 }"

Which has the logs:

[2023-04-16 13:08:51] INFO    : Received payload '{"fuel_type":"euro95", "station_id":6323 }' on topic 'dgp/gas_station'
[2023-04-16 13:08:51] DEBUG   : station: Station id '6323' from cache
[2023-04-16 13:08:51] DEBUG   : station '6323': return value '{'station_id': 6323, 'price': 1.859, 'fuel_type': 'euro95', 'station_street': 'Zonnelaan 389', 'station_address': '9742 BK Groningen', 'timestamp': '2023-04-16T10:27:40.571431+00:00', 'status': 'Ok', 'processing_start': '2023-04-16T11:08:51.450526+00:00', 'processing_time': 0.02, 'brand': 'Shell', 'name': 'Paddepoel', 'latitude': 53.235381, 'longitude': 6.539301, 'fuel': 'euro95'}'
[2023-04-16 13:08:51] INFO    : publishing station_id 6323 to mqtt
[2023-04-16 13:08:51] DEBUG   : on_message: received the topic 'homeassistant/sensor/dgp_gasstation/6323_euro95/config'
[2023-04-16 13:08:52] DEBUG   : publish_station: Waiting for discovery on topic 'homeassistant/sensor/dgp_gasstation/6323_euro95/config'
[2023-04-16 13:08:52] DEBUG   : publish_station: Setting sensor values to url 'http://supervisor/core/api/states/sensor.gas_station_6323_euro95' with token
[2023-04-16 13:08:52] DEBUG   : Starting new HTTP connection (1): supervisor:80
[2023-04-16 13:08:52] DEBUG   : http://supervisor:80 "POST /core/api/states/sensor.gas_station_6323_euro95 HTTP/1.1" 200 726
[2023-04-16 13:08:52] DEBUG   : publish_station: Status Code  = 200

Results in an 'Unknown' sensor value?
image

A script with a radius does seem to work. but it seems you can't have two of those. They will overwrite each other. so It is not useful in my use case.

Am I doing something wrong with the payload_template config, or is there a small bug somewhere?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.