Domoticz - air conditioning control

For heating/cooling related questions in Domoticz

Moderator: leecollings

ksga
Posts: 12
Joined: Tuesday 02 February 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Denmark
Contact:

Re: Domoticz - air conditioning control

Post by ksga »

logger02 wrote:"AC_model" is to select the model of the heatpump becuase in the arduino I can use all heatpump

What happen if you print "otherdevices_idx[textDev]"? it's null or it's the value of idx that you have in the devices window.

I have some problems because the text sensor wasn't connected to the gateway. Try to update the text sensor through JSON:
http://YOUR_IP:YOUR_PORT/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=EXAMPLE_TEXT
you must to change YOUR_IP, YOUR_PORT, IDX and EXAMPLE_TEXT
How do I " print "otherdevices_idx[textDev]" "? (sorry, but I feel like a complete noob).
tried adding the line, unmodified, to the script right after " print(string.format('Mode: %s, fan: %s, temp: %s, modeCmd: %s', mode, fanSpeed, temperature, modeCmd))"
when I flip a switch this is the log:

Code: Select all

2016-11-16 09:06:27.661 User: Admin initiated a switch command (5/HeatpumpMode/Set Level)
2016-11-16 09:06:27.685 LUA: Mode: Heat, fan: Fan 5, temp: 20, modeCmd: 02125220
2016-11-16 09:06:27.685 LUA: otherdevices_idx[textDev]
2016-11-16 09:06:27.692 EventSystem: Script event triggered: heatpumpalt
2016-11-16 09:06:27.663 (Heatpump) Light/Switch (HeatpumpMode)
2016-11-16 09:06:29.031 (MySensors) Lighting 2 (IRsend)
2016-11-16 09:06:29.636 (MySensors) Lighting 2 (IRsend) 
I modded the link you provided and sent a string to both the dummy AC_model device and the "IR data" device on the sensor node.
Replied with:

Code: Select all

{
   "status" : "OK",
   "title" : "Update Device"
}
, and the Data column on the "devices" tab updated accordingly.

The error message is still appearing every minute though...
logger02
Posts: 6
Joined: Saturday 12 November 2016 17:15
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz - air conditioning control

Post by logger02 »

I can see in your log that there is no fail now.

Code: Select all

   2016-11-16 09:06:29.031 (MySensors) Lighting 2 (IRsend)  


Are you sure that the text sensor is not updating now?

To print you can use: print(otherdevices_idx[textDev])
ksga
Posts: 12
Joined: Tuesday 02 February 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Denmark
Contact:

Re: Domoticz - air conditioning control

Post by ksga »

logger02 wrote:I can see in your log that there is no fail now.

Code: Select all

   2016-11-16 09:06:29.031 (MySensors) Lighting 2 (IRsend)  


Are you sure that the text sensor is not updating now?

To print you can use: print(otherdevices_idx[textDev])
Sorry... didn't want to flood the thread with the same message :)

I added the print line to the script, and the output is:

Code: Select all

2016-11-16 14:31:41.612 User: Admin initiated a switch command (5/HeatpumpMode/Set Level)
2016-11-16 14:31:41.636 LUA: Mode: Heat, fan: Fan 5, temp: 16, modeCmd: 02125216
2016-11-16 14:31:41.636 LUA: 21
2016-11-16 14:31:41.642 EventSystem: Script event triggered: heatpumpalt
2016-11-16 14:31:41.614 (Heatpump) Light/Switch (HeatpumpMode)
2016-11-16 14:31:41.767 (MySensors) Lighting 2 (IRsend)
2016-11-16 14:31:42.370 (MySensors) Lighting 2 (IRsend)
2016-11-16 14:32:00.281 Error: EventSystem: in heatpumpalt: [string "-- These are the configuration variables, set..."]:18: bad argument #1 to 'pairs' (table expected, got nil)
2016-11-16 14:33:00.316 Error: EventSystem: in heatpumpalt: [string "-- These are the configuration variables, set..."]:18: bad argument #1 to 'pairs' (table expected, got nil)
2016-11-16 14:34:00.350 Error: EventSystem: in heatpumpalt: [string "-- These are the configuration variables, set..."]:18: bad argument #1 to 'pairs' (table expected, got nil) 
The top devices off course update accordingly:

Code: Select all

Idx;Hardware;ID;Unit;Name;Type;SubType;Data;Last Seen
22;MySensors;0000001;3;IRsend;Lighting 2;AC;Off;2016-11-16 14:31:42
5;Heatpump;00014055;1;HeatpumpMode;Light/Switch;Selector Switch;Set Level: 20 %;2016-11-16 14:31:41
21;MySensors;00000102;1;IRdata;General;Text;02125216;2016-11-16 14:31:41
So it would seem that the connection to the text device is working fine. also the message is sent properly, and I'm able to make the AC turn on/off. The coding is not working, but that's for another day :)

I'd just like to work out what is required to get rid of the "bad argument #1 to 'pairs' (table expected, got nil)" error that is cluttering my log file.
logger02
Posts: 6
Joined: Saturday 12 November 2016 17:15
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz - air conditioning control

Post by logger02 »

Im not sure, but I think that your script is ok. The problem can be in other part.

What is the name of your script? you can try a name like "script_device_heatpumpalt.lua"
ksga
Posts: 12
Joined: Tuesday 02 February 2016 11:08
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Denmark
Contact:

Re: Domoticz - air conditioning control

Post by ksga »

Okay... I feel a bit stupid now....

Turns out I should create a *.lua file in "DOMOTICZ_ROOT_FOLDER/scripts/lua" and not use the web interface to add it as an event.
Created script_device_heatpump.lua in above location, and the error message has disappeared from the log, and the devices are fully functional :shock:

Now I'm just waiting for an IR-receiver to arrive from China, and I can get started on decoding my Panasonic A75C3632 remote. Hopefully someone will then help me get it added to the Arduino sketch.

Thanks for the patience @logger02
logger02
Posts: 6
Joined: Saturday 12 November 2016 17:15
Target OS: Linux
Domoticz version:
Contact:

Re: Domoticz - air conditioning control

Post by logger02 »

You are welcome ;)
jonaerik
Posts: 2
Joined: Sunday 08 January 2017 13:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Domoticz - air conditioning control

Post by jonaerik »

Hope to get some hints to finalize my IR remote.
To start with, I'm fairly new on arduino and I've built some sensors based on mysensors and I have a Domoticz controller running on raspberry pi.
I'm using the HeatPumpIR library and the lua script from Toni. The code running on the arduino has been slightly modified to support my IVT.

My problem seems to be that the IR signal is not transmitted from my arduino nano, even if debug message says everything is ok.

I've used the built in webcam of my laptop to verify nothing is transmitted from the IR LED. If I use the orignial remote I can see the IR light clearly in my webcam.

I'm using a TSAL4400 940nm LED from Aliexpress in series with a 1k ohm resistor connected to D3 and GND. I've tried 3 different LEDs from same batch.

What could possibly be the reason?

This is my serial monitor when starting up the sensor:

Starting sensor (RNNNA-, 2.0.0)
TSM:INIT
TSM:RADIO:OK
TSP:ASSIGNID:OK (ID=2)
TSM:FPAR
TSP:MSG:SEND 2-2-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
TSP:MSG:READ 0-0-2 s=255,c=3,t=8,pt=1,l=1,sg=0:0
TSP:MSG:FPAR RES (ID=0, dist=0)
TSP:MSG:PAR OK (ID=0, dist=1)
TSM:FPAR:OK
TSM:ID
TSM:CHKID:OK (ID=2)
TSM:UPL
TSP:PING:SEND (dest=0)
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
TSP:MSG:READ 0-0-2 s=255,c=3,t=25,pt=1,l=1,sg=0:1
TSP:MSG:PONG RECV (hops=1)
TSP:CHKUPL:OK
TSM:UPL:OK
TSM:READY
HeatpumpIR sensor starting up...
Number of supported models: 12
NODE:!REG
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
!TSP:MSG:SEND 2-2-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=fail:2.0.0
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=1,st=ok:0
TSP:MSG:READ 0-0-2 s=255,c=3,t=6,pt=0,l=1,sg=0:M
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=11,pt=0,l=15,sg=0,ft=0,st=ok:Heatpump Sensor
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0
TSP:MSG:SEND 2-2-0-0 s=15,c=0,t=20,pt=0,l=9,sg=0,ft=0,st=ok:IR sender
TSP:MSG:SEND 2-2-0-0 s=16,c=0,t=36,pt=0,l=7,sg=0,ft=0,st=ok:IR data
TSP:MSG:SEND 2-2-0-0 s=17,c=0,t=3,pt=0,l=7,sg=0,ft=0,st=ok:IR send
Request registration...
TSP:MSG:SEND 2-2-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
TSP:MSG:READ 0-0-2 s=255,c=3,t=27,pt=1,l=1,sg=0:1
Node registration=1
Init complete, id=2, parent=0, distance=1, registration=1

And When the command for Heatpump Mode Auto is sent from Domoticz this is the printout.

TSP:MSG:READ 0-0-2 s=17,c=1,t=2,pt=0,l=1,sg=0:1
TSP:MSG:ACK msg
TSP:MSG:SEND 2-2-0-0 s=17,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=ok:1
Requesting IR code from Domoticz...
TSP:MSG:SEND 2-2-0-0 s=16,c=2,t=47,pt=0,l=0,sg=0,ft=0,st=ok:
TSP:MSG:READ 0-0-2 s=16,c=2,t=47,pt=0,l=8,sg=0:00211114
IR code received from Domoticz...
Code: 0x00211114
IR code conversion OK: 0x211114
Model: ivt
Model #: 2
Power: 1
Mode: 1
Fan: 1
Temp: 20
All OK - sending IR command to heatpump...
TSP:MSG:SEND 2-2-0-0 s=17,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=ok:0

Thanks in advance!
jonaerik
Posts: 2
Joined: Sunday 08 January 2017 13:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Domoticz - air conditioning control

Post by jonaerik »

My bad...
I sorted the issue with IR LED not sending. I used an old sketch where IRSender was used instead of IRSenderPWM (probably in combination of updated libraries?)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest