Giter Club home page Giter Club logo

thermeq3's Introduction

Autopower

Simple device managing power outlets - RF remote controlled. DIY device based on Arduino with Ethernet shield and 433MHz transmitter and receiver. Check out our facebook profile.

Skull & Bones

You will need these parts:

  • Arduino, you can choose from Arduino with Ethernet Shield or Arduino Ethernet. If you pickup Arduino Ethernet, there is PoE version, which allows to use Ethernet wire as a power source for Arduino, e.g. one cable to Arduino means sleek look of boxed device.
  • 433MHz ASK transmitter, very cheap device. Please notice, that you need device with ASK modulation. If you wanna use original remote controller, then you'll need 433MHz ASK receiver.
  • Male to female jumper wires, if you don't wanna solder wires. Or Male to Male jumper wires and prototyping PCB board.
  • Soldering iron and simple wire, if you wanna extend range of receiver.

Where you can get these gadgets?

Libraries you'll need to download

In any case of doubt or problem, please download libraries from here.

How to setup hardware

Connect DATA pin of receiver to pin digital 2 of Arduino (this is interrupt 0). VCC and GND connect to 5V and GND on Arduino. Transmitter DATA pin connect to pin digital 7 of Arduino (if you choose other pin, please change TRANSMITTER_PIN in autopower.ino). VCC and GND connect to Vin and GND of Arduino. Its recommended to connect 9V power adapter to enhance transmit range.

How to setup software

To correctly setup Autpower, you must first edit, compile and upload sketch setupap.ino (in directory setupap/). Please edit following variables or constants:

  • if you need more that 12 characters for device name, change #define NAMES_MAX 12,
  • if you need more or less that 16 devices, edit #define DEV_MAX 16,
  • if you want more that 20 events, edit #define EVENTS_MAX 20,
  • if you have more or less that 3 special (plain) RF codes edit #define SPECIAL_MAX 3 and then edit stp.specCode array,
  • in setup(), if you don't want DHCP, set stp.dhcp to false and edit ip, dns, gateway and netmask according tou your enviroment.

Please note that Arduino Uno have limited EEPROM and SRAM, so take a look at size of variables structures. Sketch setupap.ino writes values to EEPROM, so you MUST keep it under 1024bytes.

Then you must edit (according to changes you made above), compile and upload sketch autopower.ino (from autopower/ directory):

#define NAMES_MAX 12                    // length of device names
#define DEV_MAX 16                      // number of devices
#define EVENTS_MAX 20                   // maximum number of events
#define SPECIAL_MAX 3                   // maximum number of special codes

You can change more things in autopower.ino, e.g.:

#define ntpSyncTime SECS_PER_HOUR * 4   // how often sync time, in seconds
#define localPort 8888                  // local port to listen for UDP packets
#define MAX_EXTEND 3                    // how many hour you can extend switch off time, in hours
#define CON_BUFFER 48                   // size of connection buffer for webserver.processconnection
#define DIVIDER 2                       // how many switches is on one row?
#define FIRST_DOW 3                     // use this in code, 3 = Monday is day0, 4 = Sunday is day0
#define REMOTE_SIGNAL_COUNT 3           // how many times must be signal from remote controller received
#define TRANSMITTER_PIN 7               // where's the transmitter?, pin 7

Please DON'T change these values:

#define NTP_PACKET_SIZE 48              // NTP time stamp is in the first 48 bytes of the message
#define NAMELEN 15                      // maximum length of POST name
#define VALUELEN 15                     // maximum length of POST value
#define FAILED 2                        // command num of failure msg
#define UNAUTH 3                        // command num of unathorized msg
#define SWITCH_POS 0                    // where is the switching menu
#define SETUP_POS 1                     // where is the setup menu
#define NO_DEV DEV_MAX + 1              // ID for no_device

To select another time source, just edit this (remove comments or add your favourite time server):

// IPAddress timeServer(158, 195, 19, 4);  // sk.pool.ntp.org
// IPAddress timeServer(132, 163, 4, 101); // time-a.timefreq.bldrdoc.gov 
const IPAddress timeServer(132, 163, 4, 102);    // time-b.timefreq.bldrdoc.gov

And finally admin/user name and password. Both are Base64 encoded, so feel free to edit it. Default name and password is user:user and admin:admin. Use this page to obtain Base64 encoded strings.

If you have any question don't hesitate and use out Facebook profile to ask the questions.

##Supported RC power outlets Supported remote controlled power outlets uses tribits switching, e.g. http://www.tipa.eu/en/radio-control-switch-kit-ta35/d-86641/ You can setup these outlets and remote controller by 10 DIP switches, first 5 DIPs for channel and rest of them, for address โ€“ A to E. Virtually you can control 32*5 = 160 power oulets.

Addressing

This is simple, setup your outlets and read out channel and address. Channel is first 5 DIP switches. If everything is off then channel is 0. Everything on, means you selected channel 31. Channel number is calculated as bits starting from least significant (16 + 8 + 4 + 2 + 1 = 31). Selecting address is even simplier. Just turn on desired DIP switch. First one is for A, last one for E.

Operating modes

You can operate outlet in one of these three modes:

  • Normal [Nm], operated like classic RC outlet, can be switched on and off via button on webpage. Outlet can be cycled via simple POST request.
  • Time event driven [Tm], outlet can be switched on and off, in defined time and day.
  • Counted [Cn], outlet is switched on every X minutes for defined moment of Y minutes.

If you need extend funcionality of outlet, you can do it by setting flag:

  • Normal [Nm], no extension to functionality,
  • Vacation free [Vc], outlet will be switched (if Time event driven or Counted) even if Autopower is in vacation mode, indicated by # character.,
  • Auto Off [Ao], outlet will be turned off after time period (edit this in setup), indicated by ! character,
  • Special [Sp], outlet will be turned on or off viac specCode array. Position of signal in specCode array is done by choosing channel (e.g. for position 0 in specCode choose channel 0) in setup dialog. Indicated by S character.

If outlet is in Time event driven mode, it's on time can be extended byt plus sign displayed next to the outlet name.

Other features

If you click on the clock, time will be renewed by time server. If you click on word normal, Autopower will be switched to vacation mode for 2 days (weekend) and this will be indicated by word vacation. If you again click on word vacation, vacation period will be extended by two days. if you need turn off vacation mode, please go to the setup and enter 0 (zero) into the vacation textbox and click save.

Commands

To turn on or off device 10 just visit this webpage http://ip_of_your_autopower/swt.html?cmd=9 (devices are numbered from 0, thus 9 is the 10th device). To turn on vacation mode for 10 days, just type in your browser http://ip_of_your_autopower/swt.html?vac=10. If you wanna turn off vacation mode use this: http://ip_of_your_autopower/swt.html?vac=0.

Security

If you asking why we using user/admin name and password an no SSL, answer is simple. Arduino Uno/Ethernet is not capable of SSL. So why user names and password? Because many family members can switch outlets, but few of them are able to setup these (you know what we mean :)). Yes, yes we know about sniffing and all that hacking skills. But remember, RF signals @433MHz are easy "hackable" via standalone simple remote controller.

Examples

  • Setup outlet 1, channel 31, address A, time driven, no flag.
  • Setup outlet 2, channel 31, address B, normal, auto off.
  • Setup outlet 3, channel 0, address A, time drive, special.
  • Setup event 1, with outlet 1, turn on everyday at 8:00, turn off everyday at 20:00.
  • Setup event 2, with outlet 2, turn on whatever, turn off 01:20, no day selected.
  • Setup event 3, with outlet 3, turn on Sat, Sun, 20:30, turn off Sat, Sun, 22:30.

If you manually turn on outlet 2, it'll be turned off after 1 hour and 20 minutes. Use it for example cell phone charger. At Sat and Sun, 20:30 Autopower will send plain signal from stp.specCode position 0. And the same signal will be send at 22:30. Ideal for LED dimmers etc. Everyday at 8:00 will Autopower turn on outlet 1, which will be turned off at 20:00.

thermeq3's People

Contributors

autopower avatar bilbolodz avatar codeworkx avatar tobyspark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thermeq3's Issues

Antifreeze safety feature

I think it could be a good idea to implement "antifreeze safety feature":

add the temperature sensor to arduino and if all goes TOTALLY wrong (e.x. no connection to EQ-3 MAX! cube for long time) and temperature drops bellow threshold turn the boiler on to prevent possibility of freezing (maybe there is only network error or cube is not working but radiator thermostat can turn valve on but it needs a hot water).
What do you think about it?

Valve without external wall thermostat always shows 0 temperature

Valve without external wall thermostat always shows 0 temperature. Is it good situation or is it en error. I know that presentation of these values by valve to cube is rather rare but previous script sometimes reported values. When I switched to thermeq3 never got usable temperature. Of course it could be a false positive conclusion but "just asking".

Enhancement: error reporting in bridge.json

It could be a good idea to report problems with connection to EQ3 Cube in bridge.json. It will allow (using external program and hardware) to reset Cube to get it working. Now I can see in log file:
2017/10/18 11:27:20 [DEBUG] Queueing [E] 2017/10/18 11:27:20 [ERROR] Timeout. Operation in progress. Timeout. Operation in progress.

but there is no info about it in bridge.json so Domoticz is unaware of these situation.

Temperature above 25.6 degrees

Last week the temperature outside was higher.
At some point (above 25.6 degrees) my heater started heating.
My wall thermostat was set at 69 degrees according to the log.
But is was set at 5.

I also found this on github:

https://github.com/Bouni/max-cube-protocol/blob/master/L-Message.md

On the page they say:

While valves have 11 byte long submessages a WallMountedThermostat adds another byte, making a 12 byte message.

In thermeq3 it's dev_len 12 for heater and dev_len 13 for wall thermostats.
I changed the code according (i tried) and now i get the (right) temperature from the thermostats all the time!
Except for those connected to the same room where the wall thermostat is in, they return zero.

if dev_len == 12:       # Heater thermostat
    valve_set = ord(es[es_pos + 0x08]) / 2.0
else:                   # Wall thermostat
    valve_set = (ord(es[es_pos + 0x08]) & 127) / 2.0

if valve_info & 3 != 2: # no vacation?
    if dev_len == 12:   # Heater thermostat
        valve_temp = ord(es[es_pos + 0x0A]) / 10.0  + ((ord(es[es_pos + 0x09])&1)*256 ) / 10.0
    else:               # Wall thermostat
        valve_temp = (ord(es[es_pos + 0x0C]) + (ord(es[es_pos + 0x08]) & 128 / 128) * 256 ) / 10.0


Crash course in configuration please?

Hi All,
This looks like a great project and I've purchased a Yun to try and get it working. I've been using FHEM and EQ-3 for some time but would like to just use the MAX mobile app and a boiler control - I assume thermeq3 can do this for me?

I have the sketch and linux code running. I have information in thermeq3.bridge that shows that the Yun has found by cube and the radiator valves. I haven't connected the relay yet as I want to debug my solution before I commit to installing it on my boiler. I'm not sure what I do next....

So, some questions:

  1. Do I need to modify any python settings to get the system configured?
  2. How do I see the status of the system. It looks like I should be using the section in the readme - "what can I change - in python code" but I'm not sure what to do? Can this be done from a browser? I tried this:

http://192.168.1.112/data/get/status

and it just responded with some JSON of:

{"value":"idle","key":"status","response":"get"}

When I do the following:

http://192.168.1.112/data/put/status/

I get prompted for a username and password (which looks promising). I've put in "root" and the new password I created for the "Yun" linux OS, and I then get "access to 192.168.1.112" was denied?

... or should the python be accessed from a command line / telnet session?

  1. Am I right to think I use the MAX SW to control the heating profile etc?

Thanks

Heating not heating algorithm

Could you please describe more detailed algorithm which make decision about heating. There are two (at least?) modes to calculate heat needs, there are few variables and now there are also profiles. Great thing but to make it usable for I've to tune it for my own needs. Of course I can look into source code (use the source Luke ;-)) but probably not everyone is able to do it.

Saving thermeq3.bridge to internal flash

Is it a good idea to save thermeq3.bridge file on internal flash? It has "limited" number of writes (probably there is no anti wearing controller on Yun). Maybe it should be
a) moved to SD card
b) "saved in memory" at from time to time synced to other media (SD card?)

Another Dashboard Enhancement

Love this project. It is almost 100% what I was looking for, unfortunately I'm not a Python dev, but I was able to install and make it work.
But I'd like to guess some Dashboard enhancement, I've seen this project; https://github.com/stephenmhall/PiHeating and love it's dashboard https://forum.mysensors.org/topic/2485/boiler-control-from-max-cube-to-drayton-boiler-via-raspberry-pi-vera-mysensors.

Also think that a specific "button" in the dashboard for set boiler on/off manually if necessary would be convinient.

Thanks for this great project.

Problem sending email

After upgrade to to 252 (also 254) there a problem with sending email. In previous versions there was a parameter self.mailuser now authentication is done using from_addr parameter. Unfortunately my mail server require real user name NOT email address to authenticate.

disable the duty circle.

it is possible to disable the duty circle.
This is annoying especially during testing.
thanks in advance chris

Autoupdate NOT working

2017/10/10 20:04:29 [DEBUG] Doing autoupdate...
2017/10/10 20:04:30 [INFO] Available file: thermeq3.zip, V252 with hash 24c892aa8e8b9f5533e56324888f1956
2017/10/10 20:04:30 [INFO] Actual version: 254, hash: bb85a964dd3827dd665d0c4a84e5f522
2017/10/10 20:04:30 [DEBUG] Update is not necessary.
2017/10/10 20:04:30 [DEBUG] Updating variables...

Feature request: add more information to status.json

I'm going to put all information from EQ3 Cube to Domoticz (so far just for information/analyze). Now I'm using lua script which gets these information directly from Cube. Unfortunately Cube is "one IP connection ready" and when thermeq3 and lua script (from time to time) are running same time I've got timeout on thermeq3 or script. I'm going to write script which takes information from status.json and feeds Domoticz. Now in status.json there are not all information about devices (lack info about thermostats set temperature, no info about low battery in windows sensors or ECO button). Is it possible to put all these information in status.json? LUA script attached just for information.
maxscript.zip

Feature request: posibility to send to Cube "mode AUTO/ECO" command

It could be a good idea (in my opinion) to have possibility to send (using thermeq3) command set AUTO/ECO/COMFORT to cube. I've ECO button but it's available only "physically on site". I'd like to put house in ECO mode online. There are a few utilities which connects to Cube and could to that but it's always problem with "chasing for network cube access" with thermeq3.

Question?

Hi

Excellent repository/project, Ive just purchased a Max trv,cube and one wall stat to see how they worked. The only negative I could see was the fact that the cube cant control the boiler, your script solves this!

One question, I noticed you are using the arduino Yun,, why not just a RaspberryPI? or even a C.H.I.P. device? (getchip).. Nothing against the yun but im perplexed to why you needed Python and a arduino sketch whereas python could do it all..

Just curious

Angelo
ps hope logging an issue is the right way to communicate this

Nice/status web page

It could be a good idea (in my opinion) to add to web page (nice.html status.xml) information about heating/not heating state. It allow to collect and (plot) information about "whole heating system" by external program (e.x. mrtg).

Raspberry PI/ CHIP version?

Hi there,

Id like to use your thermeq3 python code to control my boiler (I have eq3 valves etc) but not having a Yun I thought I could use my C.H.I.P (sitting there doing nothing), or a raspberry PI.. Both of these can turn GPIOs on/off and thus are ideal..

I looked at your ino code and worked out that I simply need to intercept the turnIt() function but for the life of me I cant find it in your code.. help?

Malformed "ignored" message

In version 257 (not checked in later versions) part of bridge.json seems to be malformed (problem with json parsing in javascript):

"{u'': 1924991999, '140CBF': 1508279082.8247181, '140D03': 1508279082.8245169, '13EDAA': 1508279082.8246146}"

Message from parser: SyntaxError: Unexpected token u

Dasboard enhancement

I think that "OFF" mode of radiator (set to manual and turn wheel max left) is send as mode manual and set temperature 4.5 (checked with standalone valve and wall thermostat). Maybe it's good idea to put in into dashboard?

Beta "temp" mode not working

I'm trying to use (beta) "temp" mode after enabling it (http://XXX/data/put/profile/temp, http://XXX/data/put/beta/yes), I'm receiving an error:

Traceback (most recent call last): File "/root/thermeq3/nsm.py", line 45, in <module> if t3.intervals() == 0xFF: File "/root/thermeq3/thermeq3.py", line 593, in intervals self._do_beta() File "/root/thermeq3/thermeq3.py", line 702, in _do_beta self._do_profiles() File "/root/thermeq3/thermeq3.py", line 688, in _do_profiles sm, am, kk = profiles.do(self.setup.selected_mode, self.var.act_mode_idx, self.var.situation) File "/root/thermeq3/profiles.py", line 107, in do kv = temp_mode() File "/root/thermeq3/profiles.py", line 76, in temp_mode c_temp = int(table.sit["current_temp"]) TypeError: int() argument must be a string or a number, not 'NoneType'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.