Try removing lines 28-33
Worked
and this ?
dev:2692020-10-10 10:07:26.718 pm errorgroovy.lang.MissingMethodException: No signature of method: java.util.LinkedHashMap.encodeAsJson() is applicable for argument types: () values: [] Possible solutions: encodeAsBase64() on line 168 (calledBackHandler)
dev:2692020-10-10 10:07:16.480 pm errorgroovy.lang.MissingMethodException: No signature of method: java.util.LinkedHashMap.encodeAsJson() is applicable for argument types: () values: [] Possible solutions: encodeAsBase64() on line 168 (calledBackHandler)
I am trying to make a virtual air conditioning control work but I am having difficulties
Isn't there already a port for Tasmota?
Hi,
I'm trying to port some code from ST to Hubitat here Sinope TH1120RF-3000 Drivers From Smartthings. I'm having difficulties here:
data.location_list = resp.data
It says java.lang.NullPointerException: Cannot set property 'location_list' on null object (StartCommunicationWithServer)
Another question what's the difference between:
data.deviceId = null
and
data?.deviceId = null
Thanks!
Guessing here a bit
where is data in your first example defined? There should be a
Map data
or
def data
somewhere. Ideally setting it to [:]
There is no difference on the left side of the = for
Normall it is used to avoid null reference errors on the right
ie
def a = data?.deviceId
if data was null, the ? would avoid the null reference exception and a would become null.
It does not have meaning on the left side, it is usually caused by the author doing global search and replace trying to big hammer null reference exceptions.
Thanks for you info! Good to know about the '?'.
About the data, the first occurrence of location_list was here:
data?.deviceId = null
data.devices_list.each{var ->
try{
def name_device=var.name
name_device=name_device.toLowerCase().replaceAll("\\s", "")
if(name_device==deviceName){
data.deviceId=var.id
data.error=false
state.deviceName = deviceName;
state.deviceLocation = settings?.locationname.toLowerCase().replaceAll("\\s", "");
return data.deviceId;
}else{
data.code=4001
}
}catch(e){
data.code=4003
}
}
And the second occurrence is here:
case "deviceList":
httpGet(params) {resp ->
isExpiredSessionEvent(resp)
data.devices_list = resp.data
if(resp?.data?.error?.code == "USRSESSEXP"){
askForSessionReset();
}
}
I don't know if it answers your question. Thanks for you help!
I would like to thank you for your help and ask for more help with a driver that I am modifying.
The intention of this driver is to function entirely as a virtual air conditioner, only as a command to trigger events in the webCoRE.
Everything that I need is already appearing on it, however, I am not having the status of the device. For example, when I set the device to on, it does not appear on it, this is happening in all functions. Could you please take a look at the code? Thank you very much in advance.
What do you mean by âdoesnât appear on itâ?
That Virtual Air Conditoner Device Type Handler from SmartThings appears to have been designed for the âNewâ ST App. Porting that DTH a to Hubitat may present some challenges compared to more traditional ST DTHs.
What not just use the Hubitat Virtual Thermostat, which is built-in to the Hubitat platform?
I'm trying, but here in Brazil we don't usually use a thermostat, we only use the air conditioning control manually, without this automatic temperature adjustment.
I just need a virtual air conditioning control.
I'm trying anyway to use the thermostat but it's not working properly, which is making me very frustrated.
Can you please explain more? I am curious what exactly youâre looking for in a Hubitat Device Driver.
As you mentioned, a Thermostat is designed to maintain temperature to a target by turning on/off either a cooling or heating device - in other words, a form of automatic control. Of course, a thermostat can simply be set to OFF to prevent the automatic control from occurring. However, this does not allow for manual control of the cooling or heating device.
So...I am trying to understand what exactly youâd like in a driver... Since you mentioned air conditioning, I assume you have some sort of air conditioning unit, correct? Does it have a built-in thermostat? How do you plan on having Hubitat interface with the air conditioner? You mentioned above that you donât want thermostatic control from Hubitat...so do you simply want manual on/off control?
If you can describe in detail the requirements, the community may be able to come up with a simple solution.
Thank you very much for the response and consideration. The air conditioner already has a thermostat inside it, so I Send the HVAC IR remote control code like this
IrSend {"Protocol":"COOLIX","Bits":24,"Data":"0xB2BF00","DataLSB":"0x4DFD00","Repeat":0,"IRHVAC":{"Vendor":"COOLIX","Model":-1,"Power":"On","Mode":"Cool","Celsius":"On","Temp":17,"FanSpeed":"Auto","SwingVâ:âOff,âSwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
I am thinking in some way to incorporate the other possibilities of the the native hubitat driver, I believe that some difficulties that I'm having is due to my knowledge being limited in programming.
These are the possibilities that we need in a virtual air conditioning control
"Power"
:
On, Yes, True, 1
Off, No, False, 0
"Mode"
:
Off, Stop
Auto, Automatic
Cool, Cooling
Heat, Heating
Dry, Drying, Dehumidify
Fan, Fanonly, Fan_Only
"FanSpeed"
:
Auto, Automatic
Min, Minimum, Lowest, 1
Low, 2
Med, Medium, Mid, 3
High, Hi, 4
Max, Maximum, Highest, 5
"SwingV"
: vertical swing of Fan
Auto, Automatic, On, Swing
Off, Stop
Min, Minimum, Lowest, Bottom, Down
Low
Mid, Middle, Med, Medium, Centre, Center
High, Hi
Highest, Max, Maximum, Top, Up
"SwingH"
: horizontal swing of Fan
Auto, Automatic, On, Swing
Off, Stop
LeftMax, Left Max, MaxLeft, Max Left, FarLeft, Far Left
Left
Mid, Middle, Med, Medium, Centre, Center
Right
RightMax, Right Max, MaxRight, Max Right, FarRight, Far Right
Wide
"Celsius"
: temperature is in Celsius ( "On"
) of Farenheit ( "Off"
)
"Temp"
: Temperature, can be float if supported by protocol
"Quiet"
: Quiet mode ( "On"
/ "Off"
)
"Turbo"
: Turbo mode ( "On"
/ "Off"
)
"Econo"
: Econo mode ( "On"
/ "Off"
)
"Light"
: Light ( "On"
/ "Off"
)
"Filter"
: Filter active ( "On"
/ "Off"
)
"Clean"
: Clean mode ( "On"
/ "Off"
)
"Beep"
: Beep active ( "On"
/ "Off"
)
"Sleep"
: Timer in seconds
What I need is to make a virtual driver that has these possibilities.
If I can do this I can properly control my air conditioner
Wow! Thatâs not exactly a trivial driver. Now I see why youâre trying to port the code from ST. I am still not clear exactly how a virtual air conditioner driver would ever end up sending Infrared Commands to your air conditioner. What device is sending the IR commands?
I'm using Tasmota on Tuya IR bridge model UFO - R1
If I could get a virtual driver with these possibilities I can send the information via WebCoRE to UFO-R1
Isnât there already community support for Tasmota? Iâd recommend posting your questions in the Tasmota thread.
Because in these commands I have everything that I need to guide the webcore piston
"Power"
:
On
Off
"Mode"
:
Off
Auto
Cool
Heat
Dry
Fan
"FanSpeed"
:
Auto
Min
Low
Med
High
Max
"SwingV"
: vertical swing of Fan
Auto
Off
Minn
Low
Mid
High
Highest
"SwingH"
: horizontal swing of Fan
Auto
Off
LeftMax
Left
Mid
Right
RightMax
Wide
"Celsius"
: temperature is in Celsius ( "On"
) of Farenheit ( "Off"
)
"Temp"
: Temperature, can be float if supported by protocol
"Quiet"
: Quiet mode ( "On"
/ "Off"
)
"Turbo"
: Turbo mode ( "On"
/ "Off"
)
"Econo"
: Econo mode ( "On"
/ "Off"
)
"Light"
: Light ( "On"
/ "Off"
)
"Filter"
: Filter active ( "On"
/ "Off"
)
"Clean"
: Clean mode ( "On"
/ "Off"
)
"Beep"
: Beep active ( "On"
/ "Off"
)
"Sleep"
: Timer in seconds