The brackets are a syntactic way to tell you that the elements inside them are optional, but in actual use you donât include the brackets.
When they need to be literally used, youâd see them quoted like '['. In which case you donât actually type the quotes, just the brackets and to add to the confusion⊠when you see âtest_rulesâ you do have to type the quotes
// set the total maximum output power in watts (might vary depending)
let DIMDEFAULT = 2000;
let ONBATTERY =
(items.getItem("Solar_battery_solar_generation").numericState !== 0);
if (ONBATTERY) {
gridpower = Math.round(
parseFloat(items.getItem("Solar_battery_pb").state)
);
solarpower = Math.round(
parseFloat(items.getItem("Solar_battery_solar_generation").state)
);
} else {
// we are not running on battery
gridpower = Math.round(
parseFloat(items.getItem("FroniusSymoInverter_GridPower").state)
);
solarpower = Math.round(
parseFloat(items.getItem("FroniusSymoInverter_CurrentSolarYield").state)
);
}
// calculate the percentage
let LIGHTPERCENTAGE = ((gridpower / DIMDEFAULT) * 100).toFixed(0);
// console.log("LIGHTPERCENTAGE b4: " + LIGHTPERCENTAGE);
if (gridpower >= 0 && solarpower != 0) {
if (LIGHTPERCENTAGE > 0) {
if (LIGHTPERCENTAGE > 100) {
LIGHTPERCENTAGE = 100;
}
// HSB Hue, Saturation, Brightness
// Below is 50% bright
items.getItem("Brilliant1_colour")
.sendCommand("350,99," + LIGHTPERCENTAGE); // red
colour = "255,0,0"; // red
}
} else if (solarpower == 0) {
items.getItem("Brilliant1_colour")
.sendCommand("225,99," + 50); // blue
colour = "0,0,255"; // blue
} else {
// grid exporting / negative logic
if (LIGHTPERCENTAGE < 0) {
LIGHTPERCENTAGE = LIGHTPERCENTAGE * -1;
}
if (LIGHTPERCENTAGE > 100) {
LIGHTPERCENTAGE = 100;
}
items.getItem("Brilliant1_colour")
.sendCommand("100,99," + LIGHTPERCENTAGE); // green
colour = "0,255,0";
}
// wled
//if on the battery cahnge the colur depending if negative or positive
if (ONBATTERY) {
colour = (gridpower < 0) ? "3, 252, 252" : "255, 255, 0"; //3, 252, 252 ligh blue 255, 255, 0 yellow
}
// make it positive so the minus sign doesn't display
if (gridpower < 0) {
gridpower = gridpower * -1;
}
// run the rule to send to wled (sends parameters data and colour)
let parameter = {
data: gridpower,
colour: colour
};
rules.runRule("wled_rule", parameter);
// result = actions.Exec.executeCommandLine(time.Duration.ofSeconds(5),
// "/usr/bin/mosquitto_pub","-h","192.168.1.164","-t","" + TOPIC,"-m",PAYLOAD);
// console.log("LIGHTPERCENTAGE after: " + LIGHTPERCENTAGE);
/*
console.log("Brilliant light = " + items.getItem("Brilliant1_switch").state);
console.log("gridpower = " + gridpower);
console.log("solarpower = " + solarpower);
*/
I think it is because I have declared them inside if statements and not at the start of the code. BUT it used to work before going to 5.2. Maybe it is stricter?
If you are referring to the container ports, they are unique (I did a manual check again on all the containers).
I have as well Tuya Binding working on my âproductionâ on 5.1.1. I had done a test to disable that binding on 5.1.1 and see if 5.2.0 tuya binding comes up. It did not.
I know it is a separate binding, but the Sonoff binding is acting up as well. The connector is always online. The item sometimes disconnects (when i check the next day), giving Hander_Missing_Error, but then goes online again. (i run another scan, disable, re-enable, it then decides to come online) (Not related but thought worth mentioning)
Edit I did the steps shared in the link here is the result the binding is in waiting state, resolve command did not do anything
Something within your container (or on the host computer - depending on how the container networking is configured?) is also listening on those ports. Youâd need to find it. Ask google for help in identifying it.
I have zero knowledge how the Tuya binding works. I donât know how important those UDP listeners are and whether you can just ignore this issue or try to resolve it. I âsuspectâ itâs for new device discovery but once again I have no idea.
I will submit my changes as a PR anyway - hopefully someone else will improve it, but I think it at least fixes this particular issue letting you get your things to come online(?)