Skip to content
autopower_developer edited this page Oct 17, 2017 · 14 revisions

Arduino sketch

Code

There are two parts of thermeq3:

  • python code, please use install script and run config script or edit thermeq3.json
  • arduino code, upload with IDE,

What I can change in yún sketch?

In arduino sketch

  • #define DEBUG_PRG if you wanna print debug values via serial connection
  • #define RELAY_PIN 10 where is the relay pin?
  • #define RELAY_POWER 8 where is the power for relay? undef if relay is connected to 5V directly
  • #define STATUS_LED 9 status LED pin
  • #define ERROR_LED 8 error LED pin
  • #define LOOP_LED 13 activity/loop LED pin
  • #define BLINK_INTERVAL 150 blink interval in miliseconds
  • #define WAIT_UPDATE_SYNC 10000 how many millis wait to rerun upgraded python code
  • #define IWANNABESAFE in case of any trouble, shutdown relay, undef for stay in last selected mode
  • unsigned long interval = 10*1000; loop interval in seconds, arduino'll check for messages every 10 seconds, change 10 to anything you want
  • unsigned long app_interval = 10*60000; check for running app interval in minutes, change 10 to anything you want

Messages for arduino

  • H heat!
  • S stop heating!
  • E error, error LED is lit
  • C clear error LED
  • A clear all LEDs
  • Q fatal error, lit some disco effects on LEDs
  • D dead! status LED breathing
  • R restart app, eg. after upgrade
  • 'M' show error if data from Max!Cube are not valid

Python code

Variables in bridge

You can access variables by using standard yún bridge: http://arduino.local/data/get/<variable_name>

  • app_uptime = application uptime in seconds,
  • autoupdate = if True autoupdate is enabled, False otherwise
  • command = please take a look below
  • heattime = total heat time from the midnight, in seconds, format <date>: [<seconds>, <touchtime>], at the end of the day this value is written in to the logfile
  • ignore_opened = how long is ignored opened windows, in minutes
  • ignored = hard ignored valves, which are ignored until 31/Dec/2030
  • interval = interval for checking Max!Cube, in seconds,
  • local_temp, local_humidity = temperature from local sensor, must be updated manually via bridge
  • no_oww = set 1 if you don't wanna receive open window warnings, otherwise 0
  • open_window_list = list of open windows as dictionary {'<id>': ['<room_number>', '<room_name>']}
  • preference = preference mode "per" or "total"
  • profile = profile mode, "normal", "temp" or "time", what is profile
  • status = status of device (heating, idle, starting, error)
  • svpnmw = if single valve position is over this value, heating is started, no matter how many valves is over this number
  • system_status = link
  • total_switch = sum of valve positions, no matter how many valves are in house
  • touch = timestamp of last bridgefile touch
  • uptime = system uptime
  • valve_switch = when valve position is over valve_switch then heating is started (see valves)
  • valves = how many valves must be over valve_switch to start heating
  • weather_reference = preference for weather values ["yahoo", "owm", "local"]
  • wrong_key = which key from bridge file was faulty or misinterpret

If you want change some values when nsm.py is running, just browse to http://arduino.ip/data/put/interval/<your value> to change 'interval' setting. E.g. if your browse to http://arduino.ip/data/put/valve_pos/<your value>
you can change valve_pos value (e.g. how many % must be valve opened).

Commands

You can send command for thermeq by using standard yún bridge: http://arduino.local/data/put/cmd/<command>.

Quit thermeq3

quit quits application

Reinit thermeq3 or bridge

  • init reinits python app
  • rebridge reloads bridge file

Control logging verbosity

log_debug turns on logging on debug level log_info turns on loggin on info level (default)

Mute warning for specific device

mute:<device_id> mutes warning for defined interval, please add device ID, e.g. mute:FF00FF

Remove valve from ignored/adjusted valves

adjust:<device_id> mutes warning for defined interval, please add device ID, e.g. adjust:FF00FF

Send mail report

mail sends status report via predefined mail.

Control values or status

uptime updates uptime value. updatetime updates uptime and heat time led turns on or off heating LED (according to current heat status)

Check for upgrade

upgrade checks for upgrade, and if new version is available, automatically upgrades thermeq3.

Variables in python code

  • maxeq3.py
    • self.set_zero = True: if True and read actual temperature is 0 then this value is stored, else last known nonzero value is stored, if no value is known 0.1 deg is stored