0

Configuring the REST output?

Dov Grobgeld 2 years ago updated 2 years ago 1

I'm a physicist and programmer who recently started playing with the http://sonoff.itead.cc/en/ Sonoff switches. These are wifi connected and programmable and based on the ESP8266 chip. My "jewish" ideas for using these programmable switches are:


1. Turn on a light half an hour before shabbat and chag and turn it off, whenever my wife wants to go to sleep. :-)

2. Connect them to a Yarzeit lamp and automatically turn it on according to a list of dates.


Since the ESP8266 is quite a limited processor, I'm not sure that I can fit hebcal executable onto it. But since I in any case need to turn to the internet in order to get the the current date (the SonOff switches do not have a battery for a real time clock), I thought that I can then just the same turn to the hebcal web site to do the heavy lifting calculations. (Also, that way I don't need to figure out how to cross compile hebcal and I'm lazy. ;-)


So now my question is if whether it is possible to modify the hebcal REST output? Currently the response from the example query is 67k long, and contains a lot of irrelevant info. Is it possible to get e.g. ONLY the next shabbat/hag cande lighting time?

Indeed I'm running out of memory:


MicroPython v1.9.3-8-g63826ac5c on 2017-11-01; ESP module with ESP8266
Type "help()" for more information.
>>> import http_client
>>> import ujson
>>> url = 'http://www.hebcal.com/hebcal/?v=1&cfg=json&maj=on&min=on&mod=on&nx=on&year=now&month=9&ss=on&mf=on&c=on&geo=geoname&geonameid=293397&m=50&i=on&lg=h'
>>> res = http_client.get(url)
>>> ud = ujson.loads(res.text)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError: 
>>>