5715977e62
Simple sunset/sunrise algorithm
2019-10-02 23:55:32 +02:00
02865fde72
Call mqtt_publish_stat() after setting state, not before
2018-11-05 08:17:32 +01:00
06241f2581
Ensure MQTT messages are only set if state actually changed
2018-11-05 08:04:21 +01:00
b7467e3be1
add mqtt_publish_stat() for override and timespec changes; add channel_override_clear(); call c_o_c() when Timespec.Clear removes the timespec, as there is no concept of overrides when there is no timespec set
2018-11-04 20:50:23 +01:00
8d9ed882c1
Stop setting channel_override_set() in RPC calls to change the Timespec; Detect if timespec is empty and skip driving the channel in this case
2018-11-04 20:02:49 +01:00
8c6b2f399b
add timespec_empty()
2018-11-04 19:55:54 +01:00
61ddb0334e
Commit timespec to file on Timespec.Add; Unlink timespec file on Timespec.Clear; Initialize timespec from file in channel_init()
2018-11-04 19:19:17 +01:00
8c4864b199
Remove danlging vim swap file
2018-11-04 18:57:37 +01:00
f5ea934dfb
Add timespec_{read,write}_file() and unit tests
2018-11-04 17:40:12 +01:00
5b79487ab8
Format with uncrustify
2018-11-04 16:45:23 +01:00
31dcf28ff0
Add Timespec.{Get,Clear,Add} RPCs
2018-11-04 16:45:05 +01:00
560c81cbfd
Add channel_get_timespec()
2018-11-04 16:44:47 +01:00
f8a13112b6
Fix signedness comparison for ESP8266 compiler
2018-11-04 16:22:09 +01:00
a01e548249
add timespec_clear_spec() and timespec_get_spec()
2018-11-04 16:17:35 +01:00
0ad33f5fbc
Add timespec() and channel_override logic -- so we can install a time specification with which the channels are driven, but yet allowing a human override (either by RPC or by Button)
2018-11-04 15:44:17 +01:00
d5778c6fba
Add timespec_match_now() based on localtime()
2018-11-04 15:43:32 +01:00
5c26d2d43b
format with uncrustify
2018-11-04 14:19:00 +01:00
5a39c618ce
Allow LED and Relay logic level to be inverted
2018-11-04 14:10:28 +01:00
b29edab495
Add 'duration' argument to Channel.Set RPC call
2018-11-01 21:01:37 +01:00
75eccd0447
Move to a struct with args in channel_set_cb()
2018-11-01 20:57:24 +01:00
8eb6bcb112
add channel_set_duration() for timer based polls
2018-11-01 20:29:51 +01:00
6434cb6db0
Sleep the MCU 250ms after relay on switches, to avoid brownouts. Scan the pushbutton for 100ms to ensure it was still pressed, to avoid RFI from triggering
2018-11-01 14:47:35 +01:00
d332f08da4
Make distinction between channels toggled via GPIO (button) or RPC
2018-11-01 14:31:59 +01:00
f1614f3e6e
Remove 50ms sleep time, it doesn't help
2018-11-01 14:12:13 +01:00
d673cda325
Remove cooldown check - this is not what we're looking for
2018-11-01 14:11:37 +01:00
64fc98dcf7
Add a 50ms delay after switching relays, so we avoid RF spikes from inductive loads triggering capacitive touch sensors
2018-10-31 13:51:02 +01:00
3e3d9dcbe0
Add timespec -- add tests for it too.
2018-10-28 12:47:42 +01:00
491ba88d1a
Formatting
2018-04-17 15:00:29 +02:00
8bf7b919cc
Factor out DHT
...
It's now its own library (in git@git.ipng.nl:pim/prometheus-sensors)
2018-03-04 16:38:54 +01:00
6898ff8349
Add a simple Prometheus exporter.
2018-02-25 19:59:32 +01:00
13d1ab1fa5
Add app.dht_gpio flag to find DHT sensors
...
Parse this comma separated string to find GPIO pins on which we must
enable DHT sensors. Seperators are space and comma.
Can be empty, single GPIO pins, or a list:
app.dht_gpio=""
app.dht_gpio="5"
app.dht_gpio="5,4,14"
app.dht_gpio="5 4 14"
app.dht_gpio="5, 4 14"
2018-02-13 01:15:14 +01:00
c72ea2af41
Keep a list of DHT sensors
...
s_dht is a list of MAX_DHT elements. Pass the index to the callback
so we can report on individual sensors by 0-based index.
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":0, "temp":18.80, "humidity":31.6}
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":1, "temp":18.70, "humidity":36.4}
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":2, "temp":18.80, "humidity":39.5}
2018-02-12 18:25:36 +01:00
bb62e9b6ae
Add DHT support.
...
Very rough stab just to test the waters -- this will need some
more work.
For now, hard code 4,5,15 pins (as per Sonoff SV), but before
rolling this out, add a config flag for this behavior.
Neat trick -- the presence of dht library in mos.yml triggers
inclusion of the code via define -DMGOS_HAVE_DHT=1
2018-02-11 13:20:36 +01:00
b1472d059d
Respond to upstream refactor
...
6d81a9928e
2018-02-11 12:58:32 +01:00
a0909ab6a0
Blink statusled on recv/xmit MQTT messages; debounce 200ms; trigger button on release; Prime for sonoff-basic // sonoff-sv
2018-01-25 14:52:55 +01:00
7ea1e26020
Fix JSON escaping and scoping
2018-01-24 14:27:58 +01:00
4a083555e8
Clean up RPC response.
...
- Refactor mqtt_publish_stat() to take va_list
- Make publish_stat format its response with json_vprintf() so it is
valid JSON.
- Call publish_stat in channel_set, the only place where the GPIO state
changes
- Return (valid) JSON response in all RPCs
2018-01-24 14:08:29 +01:00
118eb14447
Rewrite statusled implementation.
...
- Read it now from app.config JSON file.
- Allow for inverted status leds (Sonoff et al)
- Clean up unit tests.
2018-01-24 13:33:13 +01:00
f0fa04dc26
s/led_green/led_status/g because not all status leds are green :)
2018-01-22 23:23:43 +01:00
3327a561f9
Add channel_get_total()
2018-01-22 22:23:48 +01:00
4679636fdc
Initial checkin.
2018-01-05 16:58:15 +01:00