Open paulhollands opened 2 months ago
Hey there @borpin, @alexandrecuer, mind taking a look at this issue as it has been labeled with an integration (emoncms
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
emoncms documentation emoncms source (message by IssueLinks)
I guess you want only the feed number 5 ?
If yes, could you please try with the include_only_feed_id
parameter in your yaml conf ?
For example :
sensor:
- platform: emoncms
api_key: <api-key-removed>
url: https://emoncms.org
id: 1
include_only_feed_id:
- 5
I've just tried a few things
sensor:
This resulted in the following error
Invalid config for 'sensor' from integration 'emoncms' at configuration.yaml, line 15: required key 'id' not provided, please check the docs at https://www.home-assistant.io/integrations/emoncms
I then tried the following which results in NO errors, but I still don't get a emonCMS entity. I did a reboot on this change too.
sensor:
Sorry, the id
key is indeed mandatory to identify the emoncms instance, should be 1 in your case (only one emoncms instance which is emoncms.org) but i dont see why you dont get any entity in home assistant...
I've changed the ID to 1 and restarted, but still no entity
Below is the top portion of my configuration file if there is something above which is causing an error? I also have an old instance of HA running on another server which I'm currently migrating away from. This is still connecting to Emon and I wasn't going to disable it until I could get the new instance working. I'd assumed that since its using an API, that both HA instances could pull the data? Or at the least there would be a conflict/rejection error message on the new HA instance?
default_config:
frontend: themes: !include_dir_merge_named themes extra_module_url:
automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml
sensor:
recorder:
db_url: mysql://
So it means that your feed id is not 5. As you are on emoncms.org, it should be something higher, because there are a lot of feeds on emoncms.org....
To catch your feed id, just interrogate the emoncms API : https://emoncms.org/feed/list.json?apikey=your_api_key
You should see something like that :
here the feed id is 11 but I am using a local instance of emoncms
or you can get the id from the feed page :
I get this within a browser. Note sure if the order is important and I tried changing the ID number in the configuration file to 457137, but still no emoncms entity
FYI: my energy value is currently negative since I'm exporting electricity.
[{"id":"457137","userid":"44421","name":"1","tag":"5","public":"","size":"28617712","engine":"5","unit":"W","server":"0","value":"-2853","time":"1723553382"}]
So, your yaml should be like that :
sensor:
- platform: emoncms
api_key: <api-key-removed>
url: https://emoncms.org
id: 1
include_only_feed_id:
- 457137
Is this the case ?
I've now changed it to exactly as you've show and it all works ok!
Strange since in my earlier version of HA (2023.5.4), I didn't need to specify the include_only option and clearly ID just refers to the internal HA ID for the sensor rather than the EmonCMS feed ID? Also maybe there could be a future enhancement to include a HA error message somewhere stating "feed not found"?
Many thanks for your help!
it should have worked without the include_only_feed
but as i don't know your setup, I use this as a starting point. It is more easy to deal with one feed than with 100 :-)
The enhancement is to go to config flow so that the integration can be configured through the home assistant UI : once the emoncms server is added, the user can configure it through a feed list and manually chooses which feeds to add...
Many people are confused and think that the id
parameter in the yaml is the feed id, once the integration will be migrated to config flow, this will not be anymore a problem I think....
The problem
Hi,
I'm getting the following error within the HA logs when trying to integrate with Emon CMS. Anyone have any suggestions?
Error while setting up emoncms platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform await asyncio.shield(awaitable) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 126, in setup_platform EmonCmsSensor( File "/usr/src/homeassistant/homeassistant/components/emoncms/sensor.py", line 195, in init elif elem["value"] is not None: