Closed DmitryDemin75 closed 8 months ago
Postman App:
Sorry for the very late reaction,
For accessing the API through the restful sensor, you have to either use the hostname of the add-on or it's internal IP address. An example for creating a RESTful sensor is:
sensor:
- platform: rest
name: Humidity
state_class: measurement
unit_of_measurement: "%"
method: GET
resource: http://97683af0-bacnetinterface:8099/apiv1/device:100/analogInput:1/presentValue
The ingress link is mainly for the web UI and accessing the API from another device (I.E. your computer). The add-on will block IP addresses that aren't it's own. The ingress link will make it appear so as Home Assistant is trying to access the API.
In the API Test Tool on the add-on page, access to the API works fine, but when trying to connect to the API from Home Assistant by creating a REST sensor, access is denied with the server response: "401: Unauthorized." The same error occurs if I use the Postman application. However, access to the regular Home Assistant API (sensors, etc.) using a long-term access key works fine. In the Chrome or Firefox browsers, on which the Home Assistant page is still open and a response from the add-on API is requested, everything also works without problems with authorization.
Bepacom EcoPanel BACnet/IP Interface 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: Bepacom EcoPanel BACnet/IP Interface Bepacom BACnet/IP interface for the Bepacom EcoPanel. Allows BACnet devices to be available to Home Assistant through an API
Add-on version: 1.1.3 You are running the latest version of this add-on. System: Home Assistant OS 10.5 (amd64 / qemux86-64) Home Assistant Core: 2023.10.0 Home Assistant Supervisor: 2023.10.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 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 init-nginx: starting s6-rc: info: service init-interface: starting [12:40:52] INFO: Initialising NGINX [12:40:52] INFO: Generating BACpypes.ini s6-rc: info: service init-nginx successfully started Using enp0s3 as address: 192.168.8.20/24 [BACpypes] objectName: EcoPanel address: 192.168.8.20/24 objectIdentifier: 420 maxApduLengthAccepted: 1476 segmentation: segmentedBoth vendorIdentifier: 15 foreignBBMD: - foreignTTL: 255 maxSegmentsAccepted: 64 loglevel: WARNING defaultPriority: 15 updateInterval: 60 s6-rc: info: service init-interface successfully started s6-rc: info: service interface: starting s6-rc: info: service interface successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting [12:40:53] INFO: Running interface s6-rc: info: service legacy-services successfully started WARNING: Invalid HTTP request received. [12:41:00] INFO: Starting NGINX 2023/10/05 12:41:00 [notice] 271#271: using the "epoll" event method 2023/10/05 12:41:00 [notice] 271#271: nginx/1.24.0 2023/10/05 12:41:00 [notice] 271#271: OS: Linux 6.1.45 2023/10/05 12:41:00 [notice] 271#271: getrlimit(RLIMIT_NOFILE): 1073741816:1073741816 2023/10/05 12:41:00 [notice] 271#271: start worker processes 2023/10/05 12:41:00 [notice] 271#271: start worker process 322 2023/10/05 12:41:02 [warn] 322#322: 1 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/proxy/1/00/0000000001 while reading upstream, client: 172.30.32.2, server: , request: "GET /webapp HTTP/1.1", upstream: "http://127.0.0.1:7813/webapp", host: "192.168.8.20:8123", referrer: "http://192.168.8.20:8123/13b6b180_bacnetinterface" ERROR: Disconnected... 2023/10/05 12:41:33 [info] 322#322: 4 client 172.30.32.2 closed keepalive connection 2023/10/05 12:42:17 [info] 322#322: 9 client 172.30.32.2 closed keepalive connection 2023/10/05 12:43:23 [info] 322#322: 11 client 172.30.32.2 closed keepalive connection 2023/10/05 12:43:41 [info] 322#322: 13 client 172.30.32.2 closed keepalive connection 2023/10/05 12:45:00 [info] 322#322: 15 client 172.30.32.2 closed keepalive connection 2023/10/05 13:06:52 [info] 322#322: 18 client 172.30.32.2 closed keepalive connection 2023/10/05 13:11:16 [info] 322#322: 20 client 172.30.32.2 closed keepalive connection
configuration.yaml:
homeassistant: auth_providers:
rest.yaml:
HA API works good:
resource: http://192.168.8.20:8123/api/states/binary_sensor.broadlink_br method: GET headers: Content-Type: "application/json" Authorization: !secret api-token
sensor:
Add-on API doesn't work:
resource: http://192.168.8.20:8123/api/hassio_ingress/qCxqwqYlb6aMLNFfZwfEDQ6VyS4aSJK-Iu_nj1303MQ/apiv1/device%3A100/analogValue%3A1/presentValue method: GET headers: Content-Type: "application/json" Authorization: !secret api-token
sensor:
SUPERVISOR log: 23-10-05 13:11:31 WARNING (MainThread) [supervisor.api.ingress] No valid ingress session None 23-10-05 13:11:32 WARNING (MainThread) [supervisor.api.ingress] No valid ingress session None 23-10-05 13:26:32 WARNING (MainThread) [supervisor.api.ingress] No valid ingress session None