Solar Assistant MQTT - How to use it with Node Red?

Nope - i can guarantee you that this is not the correct topic - no one is going to write a topic name with the trailing set -m in it

Nor should you have the expamation marks around the topic

Based on what i read yesterday your topic should look like this

solar_assistant/inverter_1/output_source_priority

and the message payload should be

set -m 'Utility first'

like this

His documentation does contradict itself a bit though

After you send this command you should get a response back through MQTT on

solar_assistant/set/response_message/state

So some of the problems may be the inverted commas etc and where he is expecting those to be

If the above does not work feeding into the MQTT out node then our next step to is setup an MQTT in node monitoring everything coming into Solar Assistant (so use # as your topic) with a debug node - and then through home assistant make the mode change and you will be able to see what it is sending to SA

Craig

Also what would be a good idea is to download a SSH program (Secure Shell) to your machine (i think you use Mac ?)

Using the built-in SSH client in Mac OS X

Mac OS X includes a command-line SSH client as part of the operating system. To use it, goto Finder, and selext Go Utilities from the top menu. Then look for Terminal. Terminal can be used to get a local terminal window, and also supports SSH connections to remote servers.

Running SSH from the terminal command line

Once you have the terminal window open, you have two alternatives. The first approach is to type ssh hostname or ssh user@hostname into the terminal window. This is more familiar for Linux and Unix users who are used to using a command line.

Running SSH with a graphical user interface

The second option is to select New Remote Connection... from the Shell menu of Terminal. This opens a graphical dialog asking for the host to connect to and the user name. This also allows saving connections. This is recommended for users who are not accustomed to using a command line.

You would then open a SSH session to the RPi running Solar Assistant and login as whatever user credentials you originally used when you set it up (or were supplied if it is a full packaged solution)

Once you have a SSH sesson report back and we can get you to attach to the Mosquitto log files

Craig

OK, tried a few more things and I think I have settled on a syntax that's working. Sometimes.

Tried that but no dice. Just causes an error message. What I've found works is this:

With no
-m
at all

and no quote marks anywhere.

and the topic includes the "/set" at the end, and not in the msg.payload

With this syntax I am getting the "Saved" response and the change happens in Solar Assistant. Sometimes.

e.g. in this example I show the Charger Source setting before and after using the inject node to change it. It shows the setting has indeed changed.

But I have also noticed that the change does not always take.

e.g.:

In this case the change request was acknowledged and "Saved" but the change was not actually made. The Charger Source setting was the same before and after the request to change it was made.

Then a while later I try again and it makes the change.

:man_shrugging:

I have zero clue as to why it works sometimes but not all the time.

I have terminal on my Mac, and also SSH inside Home Assistant, although weirdly (at least the last time I used it) if I use the HA SSH then it does not show text if I am using Safari browser. I have to log out and back in with a Chrome browser to be able to see the text. NFI why but I discovered that bug by accident and after much gnashing of teeth.

I tend to take instructions quite literally, this is what I get:

I can only assume I am supposed to substitute something else for user and hostname. What I've no idea.

No idea what you are using but for example on a Pi with user name pi and address 192.68.1.20 it would be ssh pi@192.168.1.20

You can also try using the name of the pi. If the pi was called ‘testpi’ you could try ‘ssh pi@testpi.local’

I've no idea what the Raspberry Pi is called.

OK but you would know its IP address as you set it up when you setup the MQTT broker - so use the IP address in the command

ssh pi@IP Address of SA

You will be able to get the IP Address of the PI from your DHCP server (usually your internet router - and in your case the Telstra Gen 3)

You may have to contact the developer to see if he allows SSH access into the box to look at the logs of the mosquitto broker

As to why the settings are not sticking i am guess that your automations in HA are over riding them

Craig

Are you sure you do not have some timed profile or some such set in Solar Assistant that is automatically setting the system back after you make a change ?

As i said before i would monitor all the messages to and from SA and then make the change from HA and see what it is sending and receiving in MQTT so get an idea of what is going on.

As you have not stated any responses to your queries to the developer i assume he is not terribly responsive

Craig

Hostname is a generally accepted place marker in networking terms to mean the name of the host that you wish to communicate with

In your case it looks like (based on the Solar Assistant docs which appear to be quite slim) that he does not publish the name locally - only proxies it through an always on connection to the internet - so you would have to look at your Telstra router to get the name

But you already know the IP address so just substitute that instead of name

Craig

I know the local IP address, I now have this:

Nah, there is no HA automation which would over ride it instantly.

There is no such user setting in SA. It was one thought I had, some kind of default maximum number of changes within a certain time limit, but I tried waiting for a while. Sometimes after a wait it worked, sometimes it didn't.

I'll try. But if I take the computer's focus away from the NR screen, when I return it restarts NR and wipes anything which was appearing in the debug pane.

Thats not right - just run two browser windows and have them side by side on the screen so you can have one pointing at HA and the other NR - i assume you are still running NR through the HA add in ?

Just right click on the menu entry for NR and choose the option to open in another window

Craig

OK, good suggestion. Will have a look at it when I can next.

Yes

I'm having trouble reviewing the full debug data stream. Using the # topic to capture everything.

When I stop the debug node so I can scroll back to review the debug window most of what it has displayed disappears. I can only usually see about the last 10 seconds worth.

Anyway, by being as fast as I could navigating windows I managed to pull these messages out of the debug stream when I made the change to Battery Charger Source using Home Assistant.

First, the current state:

17/9/2022, 3:46:08 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[10]

"Solar only"

.
Then the command to change the state made within Home Assistant:

17/9/2022, 3:46:10 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/set : msg.payload : string[32]

"Solar and utility simultaneously"

.
Then the Saved message:

17/9/2022, 3:46:10 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/set/response_message/state : msg.payload : string[6]

"Saved."

.
I couldn't let it run any longer to see it publish the change of state but ran it a bit later to see that it had:

17/9/2022, 3:53:08 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[32]

"Solar and utility simultaneously"

.
Both Solar Assistant and Home Assistant are showing that is the current setting.

Now if I use NR to invoke a change this is what I get:

Starting state:

17/9/2022, 4:08:58 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[32]

"Solar and utility simultaneously"

.
The command to change the Battery Charge Source:

17/9/2022, 4:09:43 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/set : msg.payload : string[10]

"Solar only"

.
The Saved message:

17/9/2022, 4:09:44 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/set/response_message/state : msg.payload : string[6]

"Saved."

.
The updated state indicator:

17/9/2022, 4:11:05 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[10]

"Solar only"

This time the change stuck and is showing correctly in Home Assistant and Solar Assistant.

Now I repeat the exercise using NR to make a change again, but this time it doesn't work. Well i should say it, does, eventually it would seem.

The prior state:

17/9/2022, 4:14:22 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[10]

"Solar only"

.
The command to change Charger Source:

17/9/2022, 4:14:58 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/set : msg.payload : string[32]

"Solar and utility simultaneously"

.
The saved message:

17/9/2022, 4:14:59 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/set/response_message/state : msg.payload : string[6]

"Saved."

.
The state after - has not changed (note the time stamp, this is nearly 1 minute later):

17/9/2022, 4:15:54 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[10]

"Solar only"

.
And checked again a bit later, still not changed (just over 2 minutes later):

17/9/2022, 4:17:06 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[10]

"Solar only"

.
And the change was not made in either Home Assistant or Solar Assistant.

But then when I checked again later on, the change had taken:

17/9/2022, 4:21:11 pm[node: debug 27](http://homeassistant.local:8123/api/hassio_ingress/RbT3ePDcRwkL042BMJOx2Cx_yr9Dge6O_ahJfU57mJI/#)solar_assistant/inverter_1/charger_source_priority/state : msg.payload : string[32]

"Solar and utility simultaneously"

.
No wonder I can't work what's going on.

OK i think i can see what is wrong here

Can you make sure that your node red MQTT node that points out to Solar Assistant has the correct IP address and is NOT pointing at Home Assistant

So we want to monitor the MQTT broker on Home Assistant (as we were doing above) but when sending commands from NR - can we make sure that we are pointing to the Solar Assistant MQTT broker ?

Show us the definition of the MQTT broker in NR for both Home Assistant and Node Red

Craig

I'm trying to decipher your suggestion.

You are suggesting there are two brokers?

This is the only MQTT broker I have set up in NR:

That IP address is the Solar Assistant Raspberry Pi.

I wonder if it's something on the Solar Assistant side. I note this comment in the release notes for the current beta version of the firmware:

Not a lot of detail on what the issues or fixes are but perhaps I need to wait for this firmware update to be released. Usually an update every 3-4 weeks.

Almost certain there would be two brokers - usually one is there from HA - but maybe not

Yeah it seems unlikely though that it is a firmware issue as the same settings from HA seem to work fine - definitely raise an issue with the developer and point him to this thread with the posts about what you are seeing between NR and HA - i can not really explain why it would say the settings are saved and then ignore them

What i would suggest we do is cutdown the amount of stuff you are trying to debug to slow down the information stream - change the incmoing MQTT topic to be only the State and Command response channels and see if that helps

Craig

Craig