-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to determine a null value in existing State without Warning #519
Comments
Seems to work for me: log(JSON.stringify(getState("tradfri.0.G-131074.color"))) Log:
Which adapter version do you use? |
If state does not exist, you will get warning, like by Pittini. If state exists, but the value is null, no warning will be generated, like by AlCalzone |
Was the state maybe created after the script adapter was started? In that case, it could be the caching issue #109 |
existsState should exist in current versions as method to check a state |
No the state is some month old. |
existsState works fine, thats the solution for me. |
I think the problem is: |
I don't know what exactly is going on there. The Dp was generated from the HeatingControl Adapter, maybe you can take a look in the code to adress the problem better. |
I don't understand why you check non existing state and wondering about, that it does not exist? The long warning is because you trying to get an attribute of null object.
You will get only 2 warning:
|
Can be closed, the Problem was an misconfigured state from the Heatingcontrol Adapter. After fixing, my code works as it should. and the similar problem here: |
I have an existing state, but no value, so .val= null and .notexist=true.
If i try to determine there is an value or not i use getState() like this:
let MTDummy = getState(hcpraefix + "Rooms." + ChoosenRoom + "." + "MinimumTemperature"); if (MTDummy.val != null) { //Prüfen ob Minimum Temp Null ist setState(praefix + "RoomValues." + "MinimumTemperature", getState(hcpraefix + "Rooms." + ChoosenRoom + "." + "MinimumTemperature").val); } else { log("MinimumTemp=Null, skipping entry"); };
This works, but causes a long warning like that:
I think, there should be an possibility to dertermine the state without warning.
The text was updated successfully, but these errors were encountered: