Static ip to Zwavejs2mqtt

Aladdin

Cadet
Joined
Jan 2, 2023
Messages
1
Does anybody know how to set static internal ip to an k3s app in Truenas scale. In my case I would like to have a fixed ip to Zwavejs2mqtt app which will be used in homeassistant integration. Now, everytime the zwave app restarts it get assigned a new ip (e.g. 172.16.x.x). I played with many parameters in the GUI but without success.

Homeassistant is installed in a separate app and needs a fixed websocket address to connect to zwavejs2mqtt. It doesn't connect to localhost but only to the internal ip of Zwavejs2mqtt. No luck as well playing with app links in the format of zwavejs2mqtt.ix-zwavejs2mqtt...

Any suggestion is helpful as I'm stuck. For now I've only succeeded with mqtt (mosquitto) diffusing data I need.
 

tprelog

Patron
Joined
Mar 2, 2016
Messages
297
Hopefully, you're using the TrueCharts apps for both. Then you don't need a static IP.

See the TrueCharts docs for details

 

grigory

Dabbler
Joined
Dec 22, 2022
Messages
32
@Aladdin did you get this to work? I am having somewhat of a similar problem. Following the Linking Apps Internally article from TrueCharts, I am able to find the correct internal domain name. However, when I enter that into the zwave integration setup/config window to connect it says it cannot connect.
this is the string:
Code:
ws://zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local:3000


from the zwavejs2mqtt pod shell I check the ip and nslookup
Code:
/usr/src/app $ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr EA:3B:64:2A:10:39 
          inet addr:172.16.27.66  Bcast:172.16.255.255  Mask:255.255.0.0
...
/usr/src/app $ nslookup 172.16.27.66
Server:         172.17.0.10
Address:        172.17.0.10:53

66.27.16.172.in-addr.arpa       name = 172-16-27-66.zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local
66.27.16.172.in-addr.arpa       name = 172-16-27-66.zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local


if I use one of these it will work, in HA the zwave integration can connect during setup,
172-16-27-66.zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local
172-16-27-66.zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local
but this address is prefixed with a dynamic IP and my guess is that it may change at some point and so I would prefer to only use something like zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local

when I ping the same internal domain from the HA pod I get a different IP than I found in the zwavejs2mqtt pod.
Code:
/config # ping zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local
PING zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local (172.17.38.52): 56 data bytes
64 bytes from 172.17.38.52: seq=0 ttl=64 time=0.077 ms


I feel like I have missed something fundamental, any assistance is appreciated.
 
Last edited:

grigory

Dabbler
Joined
Dec 22, 2022
Messages
32
I resolved this issue for myself in case anyone else has the problem.
The websocket port (3000) was not set in the zwavejs2mqtt pod config. Another port was set there (in addition to the zwavejs2mqtt webui port).
Also, I needed to be sure to use the internal dns name that includes the service (ws) zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local
 

Santana-2

Cadet
Joined
Feb 16, 2023
Messages
3
Hi grigory, I am having the same problem but your solution does not seem to work for me:

- Where did you configure the websocket port? In the zwavejs2mqtt options as seen below? If not, where exactly, and how do I change it myself?

1676575721237.png

- Why did you include the service name ws? does it mean websocket?

Appreciate your reply!
 

grigory

Dabbler
Joined
Dec 22, 2022
Messages
32
Hi grigory, I am having the same problem but your solution does not seem to work for me:

- Where did you configure the websocket port? In the zwavejs2mqtt options as seen below? If not, where exactly, and how do I change it myself?

View attachment 63681
- Why did you include the service name ws? does it mean websocket?

Appreciate your reply!

Hi @Santana-2 I did not set the port in the truenas pod networking config, here is my config.
And yes, as per the link above link about inking apps internally, my understanding is that internal networking needs to have the service name correct for the dns to resolve correctly. So when connecting from the home assistant configuration i needed to use zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local


2023-02-17 11_36_54-TrueNAS - 192.168.50.200 — Mozilla Firefox.png
 

Santana-2

Cadet
Joined
Feb 16, 2023
Messages
3
Grigory you are a livesaver, after setting the port within my zwavejs2mqtt app-config on truenas Scale, I suddenly can connect with your provided hostname.

And it retains the connection after a restart. I have tried to solve this for so long...
 

truecharts

Guru
Joined
Aug 19, 2021
Messages
788
TrueTool also offers a tool to figure out service names, if anyone needs that :)
---
If you need any help with TrueCharts, please reach out to out support staff on discord directly be filing a support ticket there.
We, sadly enough, do not have the capacity to also provide support on this forum as well.
 

stephon1024

Cadet
Joined
Apr 18, 2023
Messages
5
Hey Santana, Grigory,

Appreciate the post here - I'm having the same exact issue. I'm following most of what you're putting down here, but I'm not 100% sure what to type in as the Server Host on the ZwaveJSMqtt settings page.

server host.JPG


I've got my TrueNas config port set to 3000 now, the same port as specified in the ZwaveJS settings. maybe a stupid question, but what did you put as your server host? I keep getting "Failed to Connect" even when using the full:

Code:
172-16-0-39.zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local


My local IP is 172.16.0.39 using the same method you used.

Failed 2.JPG


I'm assuming it's just because I don't know what to set as the Server Host.

Any help would be amazing. Thanks for this thread - without it i'd be even more lost...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
172-16-0-39.zwavejs2mqtt.ix-zwavejs2mqtt.svc.cluster.local
That's the reverse record... you should be using:
zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local
 

stephon1024

Cadet
Joined
Apr 18, 2023
Messages
5
That's the reverse record... you should be using:
zwavejs2mqtt-ws.ix-zwavejs2mqtt.svc.cluster.local
Hey sretalla thanks for the response. I've tried it both ways with the one i posted and the one you suggested. Do i need to place that in the "Server Host" section on the zwavejs app too?

Thanks!
 

stephon1024

Cadet
Joined
Apr 18, 2023
Messages
5
Hi grigory, I am having the same problem but your solution does not seem to work for me:

- Where did you configure the websocket port? In the zwavejs2mqtt options as seen below? If not, where exactly, and how do I change it myself?

View attachment 63681
- Why did you include the service name ws? does it mean websocket?

Appreciate your reply!

Hey Santana - I saw you were able to get this to work, i'm having the same issue. Just one question... I follow most of this, but I'm wondering what you put in for the "Server Host" above in this response... I feel like that's the missing piece for me to get this to work as well.

Thanks!
 

TrueNaut

Cadet
Joined
Sep 15, 2023
Messages
5
I installed it fresh yesterday and got it working. Hopefully, it helps someone.
  1. Check the port number by editing zwavejs2mqtt on TrueNas Scale. Mine was set to 10046 for the WebSocket Service Port Configuration.
  2. In Home Assistant for Zwave integration, use the IP of TrueNas Scale and the corresponding port number (10046) for configuration.
 

stephon1024

Cadet
Joined
Apr 18, 2023
Messages
5
I installed it fresh yesterday and got it working. Hopefully, it helps someone.
  1. Check the port number by editing zwavejs2mqtt on TrueNas Scale. Mine was set to 10046 for the WebSocket Service Port Configuration.
  2. In Home Assistant for Zwave integration, use the IP of TrueNas Scale and the corresponding port number (10046) for configuration.
Hey TrueNaut,

Thanks for the reply!

Honestly, I ended up going a completely different direction on this with regards to the zwave js-ui. I ended up just installing it on a Ubuntu Linux VM using Snap and that's been great. Once that was up and running Home Assistant recognized it right away - no setup even required which honestly surprised me. The nice thing about Snap is you just subscribe to your desired channel and it keeps the software updated.

However, it's been really nice having the VM running the software in Linux because the VM has an internal IP address, etc. that makes it really easy to reference with other tools. I'm also running Mosquito MQTT in the VM as well so it ended up working well. I love the fact that TrueNas Scale has these apps, but in many ways sometimes I think it's just easier to run a Linux VM and run the software natively in them.

Thanks again tho, if I ever feel the need to switch back to the TrueNas Scale app version, I'll give this a shot.
 
Top