(Code snippets below has been edited to hide sensitive information)
I have an app that creates multiple sensors in AppDaemon, ex.py
From dashboard at port 5050, I can see each entity under the entities tab and namespace “default”, the state value and attributes are as expected. Under the plugin tab there is nothing.
I expected to see the same entities in Home Assistant, but they never show up. I have tried restarting both HA and AppDaemon.
I’ve tried searching, and reading the AppDaemon docs, but can’t figure out why the entities are not visible in Home Assistant.
appdaemon.yaml
appdaemon:
latitude: xx.xxxxx
longitude: x.xxxxx
elevation: 2
time_zone: Europe/Amsterdam
plugins:
HASS:
type: hass
ha-url: http://xxx.x.x.x:xxxx
token: xxxxxxx
namespace: default
http:
url: http://xxx.x.x.x:5050
admin:
api:
apps.yaml:
example:
module: ex
class: example
ex.py:
import hassapi as hass
import requests
from datetime import date, datetime, timedelta
import json
class example(hass.Hass):
def initialize(self):
self.log("example")
starttime = datetime.now() + timedelta(seconds=5)
self.run_every(self.checkup,starttime,600)
def checkup(self, kwargs):
headers = {
'accept': 'application/json',
'referer': 'url',
'user-agent': 'Mozilla.....',
}
params = {
'from': '2024-12-30',
'to': '2025-01-01',
'today': '0',
'location': 'gdfghdjkg-gdfgdfg-dfgdfgd',
}
response = requests.get(
'url2',
params=params,
headers=headers,
)
points = response.json()
nr = 0
for point in points["key"]:
nr += 1
name = point["key2"]["name"]
name2 = point["key3"]["name"]
self.sensorname = ("sensor.point_%s" % nr)
self.set_state(self.sensorname, state = name, attributes = {"name number 2": name2 })