Emoncms self contained docker container and HomeAssistant Addon

Yes, that looks good and what I have tested seems to work :slight_smile:

Can I be a pest and ask for the option to show in sidebar?

image

Iā€™ll switch on auto-update - should that work?

Right now I dont know how to do it. To what Iā€™ve understood, first the app has to have ingress enabled in order to be embedded inside HA.

1 Like

Ok, a nice to have rather than essential :slight_smile:

what you can do is to add to the sidebar a shortcut to the addons panel

#Add this to your configuration.yaml
panel_custom:
  - name: addons
    sidebar_title: Addons
    sidebar_icon: mdi:cog-transfer
    js_url: /api/hassio/app/entrypoint.js
    url_path: "hassio/dashboard"
    embed_iframe: true
    require_admin: true
    config:
      ingress: core_configurator

to edit the configuration.yaml with the HA gui, install the configurator add-on (here File editor)

For the new configuration to be online, you have to restart Home Assistant

Instead of linking to the addons panel, you can directly link to the emoncms panel

the url has to be something like that : hassio/addon/60ed1c84_emoncms/info

the sidebar is like that after :

1 Like

For people who are not using home assistant, I wrote a small digest on how to take hands on docker :

1 Like

Added a new build including emoncms version number, using the stable release

the latest docker image has got the following tag : alexjunk/emoncms:alpine3.18_emoncms11.4.5

docker pull alexjunk/emoncms:alpine3.18_emoncms11.4.5

nota : the docker image used in the home-assistant addon is right now the one without version numberā€¦

@borpin : I just been working implementing the ssl in the dockerfile.
a commit prototype is here :

I introduced some new vars and wanted your point of view on that :

  • CRT_FILE, for the public key
  • KEY_FILE, for the private key
  • CNAME, for the domain name

maybe I should add also CA_FILE, the public key for the certificate authority (CA) ? although it is not necessary with self signed certificatesā€¦

as far as docker is concerned, things are working, but I did not test on HAā€¦

How do you run your HA with ssl ? You generate a certificate directly in command line using openssl ? and then modifying configuration.yaml ? you allow to browse on https(443) and http(80) or there is a redirection from 80 to 443, so when you try to browse with http it redirects automatically to https ?
I began searching the docs but as I you already experienced running HA in ssl, maybe you could tell meā€¦

best

1 Like

A long time since I got it working but, internally I have these 2 addons installed.
image

image

I have a domain I use solely for internal SSL certificates, from LetsEncrypt, authenticate through DNS Challenge with Cloudflare (as they are not routable) and then set Pi-Hole to do the lookup for those domains to fixed LAN IPs.

So internally, https://xxx.borpin.net just works :slight_smile:

This does need an automation to trigger the LetsEncrypt addon as it only runs otherwise at restart.

I use Nabu Casa for remote access.

[edit]
You might try reaching out to Frenck on Discord if you get stuck as he has loads of add-ons that use SSL.

Thanks, I guess you are using this one :

Iā€™ve tried another one which does not need any extra addons, and creates the letā€™s encrypt certificates :

I managed to make it work, it needs configuration.yaml to include an http section in order to define the reverse proxy to the rest of the network :

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

172.30.33.0 is the hassio network, you can check with docker network ls and docker network inspect hassio

Then adjust a NAT/PAT rule on your router so that the traffic on port 443 goes to the reverse proxy. In my case, I have an orange box, it is like that :

You can proceed to the ssl configuration :

  1. Get a valid domain name / cname with duckdns for example, through your github access it will give you a token
  2. When the nginx proxy manager addon is up, create a Letsā€™encrypt certificate, with the DNS Challenge method and fill the credentials with your duckdns token
  3. Create a proxy host using the domain name, associate the certificate and choose the force SSL option

When accessing from outside through the domain name, all traffic is crypted
In my case local browsing stays uncrypted, probably because i dont have NAT Loopback (?) on my router

Sorry, a bit late to this - shouldnā€™t this be multiple containers, as such done through a docker-compose file?

@datoon : thanks, you mean multiple containers for the emoncms docker or for the nginx proxy ?
For the emoncms docker, self contained approach with s6-overlays is better :slight_smile: In a multi container approach, it will be difficult to have all the features working because of the design of emoncms.

Sorry, maybe I misread home assistant as home assistant core.

I run HA with MQTT using docker compose.

It should work also on HA with MQTT using docker compose. It works both as an HA addon and as a standalone docker containerā€¦there is little differenceā€¦

@borpin : with the Nginx Proxy Manager (NPM) which is a reverse proxy, the addon in its current version works in https from the outside, but your remark was focused on internal network ? with the new version of the NPM addon, you dont need anymore automation. I dont know if/how certificates are automatically renewed ?

It is one of those things - ainā€™t broke; donā€™t fix.

It works fine for what I need (SSL inside my LAN) and external access provided by a Nuba Casa subscription.

Iā€™ve produced a new version for the homeassistant addon, with ssl/https.

No real issues during the migration but as mariadb changed version, the container log was filling with warnings :

2024-02-11 21:22:56 701 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
2024-02-11 21:23:01 702 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').

I had to alter the tables manually to remove them

MariaDB [(none)]> ALTER TABLE mysql.column_stats MODIFY histogram longblob;
Query OK, 0 rows affected (0.102 sec)              
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [(none)]> ALTER TABLE mysql.column_stats MODIFY hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB');
Query OK, 0 rows affected (0.033 sec)
Records: 0  Duplicates: 0  Warnings: 0

see migrating HA addon to version alpine3.18_emoncms11.4.11 - possible issues Ā· Issue #7 Ā· Open-Building-Management/emoncms Ā· GitHub

1 Like

@borpin : is it possible for me to edit the first messages of the topic, those created in June 2023 ?

I would like to modify things as they are linking to dockerfiles using supervisord which is not the way to go and some docker commands are using docker images I would like to delete on the docker hub ?

Iā€™ve seen you modified the title in October 23

I donā€™t think you can, but the Moderators and Admins can. So if you let one of us know exactly what you want changing in a PM, or by flagging the post, or just post the edited version with a note that you want it to replace the old version (with a link to the old), we can make the changes for you.

[Edit: Done 25/02/2024]

Hello.

Firstly, THANK YOU SO MUCH FOR THIS ADDON. You donā€™t know how much it means to me and my friends to find this.

Secondly, bit of a noob so forgive me for my questions:

A. How to get MQTT data into this emoncms addon.

i presently have MQTT data getting sent into Home Assistant.

The publisher on the local network is at 192.168.1.101
topic prefix is: solar_assistant/#
no user/pass since its only local

i tried putting that 192.168.1.101 into the MQTT host box, and restart the add-on, but thereā€™s no sign of the data as inputs

B. How to get emoncms published publicly

Tried following the convo above about NGINX above but frankly iā€™m lost

I have a domain which i use for Home Assistant itself via the Cloudflared add-on to make it accessible remotely

Thanks

For the A, see https://github.com/Open-Building-Management/emoncms/discussions/16#discussioncomment-9239523

For the B, dont know the cloudflare addon but to deal with access from outside with the nginx proxy manager, i wrote a small guide here :

Hope this will help :slight_smile: