Installing Home Assistant on WD mycloudEX2Ultra

Hello,
because I wanted to play around with HomeAutomation issues a little bit, I intended to buy an raspberryPi 4 , because there are lots of tutorials how to start with it.
Unfortunately they are hard to get and so I found some articles, describing how one used their NAS for HomeAssistant server.
So I gave it a try, but it took me quite some time to get „HomeAssistant“ eventually running on my WD mycloudEX2ULTRA. Because some people might be interested in giving their device an additional task, I put together my experiences.
I will guide you step by step and link some pages, that had relevant information for me.

1. Upgrade to version 5 of mycloud firmware
I did not make it, to get docker running on version 3 – so please upgrade first.

2. Install docker on your device
Docker auf einer WD MyCloud installieren - geht! - WD Deutsches Forum / Netzwerk Laufwerke - WD Community [German]
download installation file
Docker 20.10.15 · JediNite/wdpksrc (github.com)
Install with menu entry „Apps – install an app manually“

3. Enable SSH on device
Menu entry Settings ->network

4. Assigning new port for portainer, when using Twonky
Twonky & pre-installed portainer unfortunately use the same port 9000
As you can’t change the port for Twonky, here is the instruction, how to change for portainer
Port number for Portainer - Docker - openmediavault

Login to your device by ssh
If portainer is already running, you have to stop it before you can start the new instance with a different port assignment

docker run -d -p 9001:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

You can also change the link of the WD-UI:
Docker Install on PR4100 · Issue #37 · WDCommunity/wdpksrc

You may want to edit the redirect in /shares/Volume_1/Nas_Prog/docker/web/index.html to point to the new port and also change the script /shares/Volume_1/Nas_Prog/dockerupdate_portainer.sh.

5. Home Assistant dockerfile
When trying to start the „homeassistant:latest“ I noticed several problems
First of all there is the JEMALLOC issue, so make sure you always set the ENV variable.

DISABLE_JEMALLOC true

Furthermore there was an issue with „wheels“.
2022.7.x docker container broken on 1st gen Raspberry Pi · Issue #75142 · home-assistant/core
So I used 2022.6 docker container for home assistant to setup.
When I wrote this tutorial, I had a look again and found out, that the issue was just fixed.
So I updated and I’m happy to have the current system running now:
Here is the docker-compose, I use as stack in portainer.

version: "2"
volumes:
  homeassistant_data:
    external: true
services:
  homeassistant:
    container_name: HomeAssistant
    image: linuxserver/homeassistant:latest
    restart: unless-stopped
    volumes:
      - homeassistant_data:/config

So when your container is running, you should be able to reach HomeAssistant on port 8123 of your WDmyCloud IP adress.

Congratulations → you basically made it !

6. Install HomeAssistant configurator (text-editor)
For some small hacks and configurations you could need a handy editor.
I don’t understand why, but the configurator is not part of the docker distribution of HomeAssistant.
But we can run it as a separate docker-file
Home Assistant Container Part 6: Editing configuration.yaml from within Home Assistant :: Sequr
And here is my docker-compose, which matches directly to my HomeAssistant stack:

version: "2"
volumes:
  Configurator:
    external: true
  homeassistant_data:
    external: true
services:
  hass-configurator:
    container_name: hassconf
    image: causticlab/hass-configurator-docker
    restart: unless-stopped
    ports:
      - "3218:3218/tcp"
    volumes:
      - Configurator:/config
      - homeassistant_data:/hass-config

7. Getting basic health values for your NAS
Having set up HomeAssistant as your dashboard, you might want to keep an eye on your devices health status.
You can start with the basic ones of the included systemmonitor.
System Monitor - Home Assistant

8. Getting more info with SNMP Sensors
I’ve been inspired by this post:
WD EX4100 NAS SNMP Sensors - Share your Projects! - Home Assistant Community
Unfortunately the WD mycloudEX2Ultra seems to use different OIDs, so here is the part from my sensors.yaml what I got working so far:

- platform: snmp
  name: 'NAS Disk 1 Temperature'
  host: 192.168.1.8
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.10.1.5.1
  community: 'public'
  version: '2c'
  unit_of_measurement: '°C'
  value_template: "{{ value.split(':')[1] }}"
  scan_interval: 60

- platform: snmp
  name: 'NAS Disk 2 Temperature'
  host: 192.168.1.8
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.10.1.5.2
  community: 'public'
  version: '2c'
  unit_of_measurement: '°C'
  value_template: "{{ value.split(':')[1] }}"
  scan_interval: 60
  
- platform: snmp
  name: 'NAS Fan Status'
  host: 192.168.1.8
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.8.0 
  community: 'public'
  version: '2c'
  value_template: "{{ value }}"
  scan_interval: 60

- platform: snmp
  name: 'NAS Size'
  host: 192.168.1.8
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.9.1.5.1
  community: 'public'
  version: '2c'
  value_template: "{{ value.replace('T','') }}"
  unit_of_measurement: 'TB'
  scan_interval: 300

- platform: snmp
  name: 'NAS Free Space'
  host: 192.168.1.8
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.9.1.6.1
  community: 'public'
  version: '2c'
  value_template: "{{ value.replace('T','') }}"
  unit_of_measurement: 'TB'
  scan_interval: 300

- platform: template
  sensors:
    nas_free_pct:
      friendly_name: 'Free Space'
      value_template:  "{{ ( 100 * states('sensor.nas_free_space')|float / states('sensor.nas_size')|float |round(1) }}"
      unit_of_measurement: '%'

Conclusion:
I have HomeAssistant running on my WD mycloudEX2Ultra for around 40 days now and I’m quite happy with it.
Processor usage in normal operation mode is less the 10% .

Regards.
Matt

6 Likes

Hi Matt

Thank you for your sharing.
I did some improvements in your sensors to convert ‘NAS Size’ and ‘NAS Free Space’ to GB, otherwise if free space is less that 1TB ‘NAS Free Space’ and ‘Free Space’ will be invalid.

- platform: snmp
  name: 'NAS Size'
  host: 192.168.1.200
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.9.1.5.1
  community: 'public'
  version: '2c'
  value_template: >
    {% if 'G' in value %}
      {{ value | replace('G', '') | float }}
    {% else %}
      {{ value | replace('T', '') | float * 1024 }}
    {% endif %}
  unit_of_measurement: 'GB'
  scan_interval: 300

- platform: snmp
  name: 'NAS Free Space'
  host: 192.168.1.200
  baseoid: 1.3.6.1.4.1.5127.1.1.1.8.1.9.1.6.1
  community: 'public'
  version: '2c'
  value_template: >
    {% if 'G' in value %}
      {{ value | replace('G', '') | float }}
    {% else %}
      {{ value | replace('T', '') | float * 1024 }}
    {% endif %}
  unit_of_measurement: 'GB'
  scan_interval: 300

I fixed the value_template of ‘Free Space’, was missing a “)”.

- platform: template
  sensors:
    nas_free_pct:
      friendly_name: 'Free Space'
      value_template:  "{{ (100 * states('sensor.nas_free_space')|float / states('sensor.nas_size')|float) |round(1) }}"
      unit_of_measurement: '%'

Best regards

1 Like

Hi. This is a noub trying to install HA on his mycloudEX2Ultra following you method but unfortunately it fails to access 192.168.0.41:8123/.
Any idea of what is blocking?
EDIT: weird IP
Where does it come from?

Hi, I followed your guide on my nas, but my docker can’t startup

Hey, first of all many many thanks for the great tutorial. I have done everything as described. The container HomeAssistant is also on run. However, I can not reach him. Where to enter the commands?

version: "2"
volumes:
  Configurator:
    external: true
  homeassistant_data:
    external: true
services:
  hass-configurator:
    container_name: hassconf
    image: causticlab/hass-configurator-docker
    restart: unless-stopped
    ports:
      - "3218:3218/tcp"
    volumes:
      - Configurator:/config
      - homeassistant_data:/hass-config

I specified this command under Env when creating the container:
DISABLE_JEMALLOC true

What else could it be that I can’t reach Home Assistant on my ip:8123? Thanks for the help!

Best regards,
Philip

1 Like

I have the same problem. Will someone help??

I have a problem with point 5
When I type as stack in portainer
I have an answer
failed to deploy a stack: homeassistant Pulling no matching manifest for linux/arm/v7 in the manifest list entries
What do I do with it??

Were you able to run HomeAssistant?
What was the problem?

Hi,

The problem is the latest version of homeassistant docker isn’t compatible with armv7l hence the error you are getting.
According to this page : GitHub - linuxserver/docker-homeassistant

03.05.23: - Deprecate arm32v7. Latest HA version with an arm32v7 build is 2023.4.6.

I managed to get it running using the following configuration (no need for DISABLE_JEMALLOC true) :

edit: see my post below for the config I am actually using.

version: "2.1"
volumes:
  homeassistant_data:
    external: true
services:
  homeassistant:
    container_name: HomeAssistant_compose
    image: linuxserver/homeassistant:2023.4.6-ls141
    restart: unless-stopped
    privileged: true
    network_mode: bridge
    ports:
      - "8123:8123"
    volumes:
      - homeassistant_data:/config
    environment:
      TZ: Australia/Melbourne

I have not played with yet, but I can load the login page, so it’s a start.

It works. Thank you.

I realised you need to run in host mode to get home assistant do autodetect devices on the network, I ended up with the following config:

version: "2.1"
volumes:
  homeassistant_data:
    external: true
services:
  homeassistant:
    container_name: HomeAssistant_compose
    image: linuxserver/homeassistant:2023.4.6-ls141
    restart: unless-stopped
    privileged: true
    network_mode: host
    ports:
      - "8123:8123"
    volumes:
      - homeassistant_data:/config
    environment:
      TZ: Australia/Melbourne
1 Like

Hi I still can’t quite make this work. I’m getting an error Stopped for a few seconds with exit code 139 and there is no ip assigned to it. Do you have any idea of what you did to get this working for you ?

! As an update, i managed to get it running by going into stacks, add stack → web editor and pasting in this code from Geatan

 version: "2.1"
volumes:
  homeassistant_data:
    external: true
services:
  homeassistant:
    container_name: HomeAssistant_compose
    image: linuxserver/homeassistant:2023.4.6-ls141
    restart: unless-stopped
    privileged: true
    network_mode: host
    ports:
      - "8123:8123"
    volumes:
      - homeassistant_data:/config
    environment:
      TZ: Australia/Melbourne

Thanks for the support.
Regards!

What docker are you using? I’m getting

2023-08-04 14:34:20.287 WARNING (MainThread) [homeassistant.setup] Setup of image_upload is taking over 10 seconds.
2023-08-04 14:34:20.780 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
2023-08-04 14:34:20.971 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=73 from 2023-08-04 14:33:28.706430)
terminate called after throwing an instance of 'std::runtime_error'
  what():  random_device::random_device(const std::string&): device not available

i also had this same error today and i deleted everything, started from scratch and installed docker version docker_21.04.06_EX2Ultra.bin, after that, did HA install using stacks and the code from Geatan and for me it worked fine.

good luck

Hi, thank you for the guide.

Even if I am noob I was able to make it run with Geatan code…unfortunately I get the following error when trying to add configurator:

Python runtime state: core initialized

PermissionError: [Errno 1] Operation not permitted

Current thread 0xb6dd2390 (most recent call first):

<no Python frame>

any ideas?

THANK YOU! This is the ONLY sequence that worked for me, I’ve been trying to install home-assistant as a container to docker to my EX2 Ultra for the last 6 months in vain. Thanks also to @Gaetan that provided the only stack that worked and to @MattBavaria for going to great lengths to get the home assistant in an EX2 Ultra.

briefly what I’ve done was the following:

  1. I’ve updated the docker version to the Cloudsmith version of the docker named docker_21.04.06_EX2Ultra.bin

you can find it on the following link:

https://dl.cloudsmith.io/public/wd-community/EX2Ultra/raw/names/docker/versions/21.04.06/docker_21.04.06_EX2Ultra.bin

Note: I didn’t have to uninstall the previous version of the docker, I’ve just updated it over the 20.10.15 JediNite/wdpksrc version I had as I didn’t want to go straight to the nuclear option to erase all the other containers that were working fine. Still worked.

  1. Go to the Portainer (yourlocalIP:9001) and then choose the docker, then the stack tab, choose “+add stack” and copy paste in the web editor @Gaetan configuration and hit “deploy stack”:
version: "2.1"
volumes:
  homeassistant_data:
    external: true
services:
  home-assistant:
    container_name: HomeAssistant_compose
    image: linuxserver/homeassistant:2023.4.6-ls141
    restart: unless-stopped
    privileged: true
    network_mode: host
    ports:
      - "8123:8123"
    volumes:
      - homeassistant_data:/config
    environment:
      TZ: Australia/Melbourne

(I didn’t even change the TZ, lol!)

After a long wait downloading and installing the file, Home Assistant WORKED! Amazing!Thank You!

Note all the other versions of the docker/home assistant combination seem not to be able to handle home-assistant any more, with or without disabling JEMALLOC including the @MattBavaria workaround (I may be wrong on this as may technically be a noob and it is possible that I wasn’t able to follow complex instructions) and the home assistant is stuck in an infinite restart loop. This is possible due to the depreciation of the home-assistant support for older Linux kernels and my understanding is that the kernel the EX2 Ultra using is pretty old. Not a clue how that would affect home-assistant/docker integration in the future, but as long as there are no critical issues with this build I would not update ever or at least till I’ve changed NAS!

Hi coolajami,
many thanks for your work. I was able to install the docker / Home Assistant combination on my EX2 Ultra. But I had to create the homeassistant_data Volume manually with portainer, before the stack based deployment has worked.

Perhaps this Info is helpfull to someone.

Kinde Regards,
Christof

2 Likes

My Stack:

version: "2.1"
volumes:
  homeassistant_data:
    external: true
services:
  homeassistant:
    container_name: HomeAssistant
    image: homeassistant/armv7-homeassistant:latest
    restart: unless-stopped
    privileged: true
    network_mode: host
    ports:
      - "8123:8123"
    volumes:
      - homeassistant_data:/config
    environment:
      TZ: Europe/Berlin

But the Port isn’t published


What could be the Problem?

okay, the ports a published despite it’s not shown in portainer.
But only linuxserver/homeassistant:2023.4.6-ls141 works

2 Likes

I have HA 2023.4.6 working but I cannot add HACS to that version as far as I can tell it has to be 2023.6.0 or later. Any ideas?

1 Like