NSPanel-setup icon indicating copy to clipboard operation
NSPanel-setup copied to clipboard

First panel not working

Open anixi opened this issue 2 years ago • 5 comments

Hi @alfpf Thanks for working on the OpenHAB3&NSpanel installtiona and configuration guide. I have worked my way through and have mikes test panel as shown on page 23. However, I cannot get the first panel working. Although the steps are clear I don't understadn where/how to get the config file that is presented in black on top of page 31. Where do you make this file and how do I know/set the channel for "channel="<your channel to Outdoor thermometer>"}". THanks for helping me out here! BEst regards, Henk

anixi avatar Apr 01 '23 21:04 anixi

Hi, I’m an old schooler and use configuration files for my items. The newer versions of OpenHAB have a pretty good graphical interface instead, so I’m guessing this is what you are using? Principles are however the same. Things have Channels and Items can be associated with these channels (to receive/send the values from/to the channel). So if you eg. define a new string item nxpanel_weather_command using the OpenHAB graphical interface, and if you then edit this Item, you will see a header called ”Channel links” and a ”add link” below. This is where you can connect you Item nxpanel_weather_command to the Channel nxpanel_weather_command of the Thing NSPanel1. The result is the same as the assignment done in the first line in the black box. What might be a bit confusing is that both the Item and the Channel in this example have the same name. Hope this helps. /Alf

alfpf avatar Apr 02 '23 16:04 alfpf

Hi @alfpf, Apologies for coming back here but still issues to get the temperature to the NSpanel. I am usiing OH3 and all settings within OH3 are working now and the Item gives the current temperature in the room. However, it is not updated to the NSpanel. In the OH log I get the error "item not found in the registry" . I am using the graphical interface so the settings are stored in the JSONDB directory. By using a simple command using a MQTT explorer it is possible to change the text in the temperature field. Hope you can help! Best regards, Henk

anixi avatar Apr 12 '23 22:04 anixi

Hi, I think you need to do is create an item called ”nxpanel_temperature_command” using the graphical user interface. Going to Settings—> Items and then press the ”+” sign on the items menue and then select ”Add Items from Textual Definition”. Then add the line (it’s the same line as in the black box on page 30):

String nxpanel_temperature_command {channel="mqtt:topic:mosquitto_sweden3:nspanel1:nxpanel_temperature_command"}

(Note! Make sure the channel value matches your actual channel string)

Save this and when you now check your channels for the NSPanel1 Thing (Settings—>Things—>NSPanel (Generic MQTT Thing)—>Channels), a blue dot should have turned up on the channel called ”NXPanel Temperature Command”. If you expand it, it should show the Item you just created above.

The ”sending” of the actual temperatures is initiated by the rule created in section Push Temperature(s) to NSPanel (page 32). This rule itself does not send anything, it just assigns a JSON value to an Item. However as the Item is linked to a channel, this is where the ”sending” is done.

The ”When” section of the rule should trigger if any of your two temperature items changes, one trigger is for indoor temp and one for the outdoor temp. The ”Then” section of the rule is a Groovy script where the values of the temperature items are assigned to the nxpanel_temperature_command - The Item you created above. As this Item now is linked to the channel called NXPanel Temperature Command, the value of the Item (the formated JSON string containing the temp values) is sent using MQTT to NSPanel.

alfpf avatar Apr 16 '23 21:04 alfpf

Hi @alfpf , thanks for you further explanation, I am working my way through and can confirm that it works now. Working on the other switches currently!

anixi avatar Apr 17 '23 15:04 anixi

Hi ALFP, it all works now except for the Forecast_WeatherIcon_1day. The Item works as I see the Icon in the item of OH, however the rule doesn' t "copy" the string of the image. From the log file: nxpanel_weather_command: { "weather": { "temp": 13, "icon": "raw type (image/png): 3793 bytes", "feels": 12 } The items shows: image The script in the rule is: import org.slf4j.LoggerFactory def logger = LoggerFactory.getLogger("org.openhab.core.automation.nspanel")

def weather = ir.getItem("Forecast_WeatherIcon_1day").state.toString()
def forecastTemp = ir.getItem("Forecast_Temp_1day").state.intValue()
def forecastFeelsTemp = ir.getItem("Forecast_Feels_1day").state.intValue()

def json = String.format(
"{ \"weather\": { \"temp\": %d, \"icon\": \"%s\", \"feels\": %d } }",
forecastTemp, weather, forecastFeelsTemp)

events.sendCommand("nxpanel_weather_command",json)

logger.info("nxpanel_weather_command: "+json)

As earlier , Help is appreciated!

anixi avatar Apr 21 '23 12:04 anixi