Originally posted by paulockenden
View Post
2015-10-29 09_50_09-https___admin.bsdfreaks.nl_munin_static_dynazoom.html_cgiurl_graph=_munin-cg.jpg
git clone git://github.com/samuel/python-munin.git sudo pip install ./python-munin
wget https://launchpad.net/python-weather-api/trunk/0.3.8/+download/pywapi-0.3.8.tar.gz tar -zxvf pywapi-0.3.8.tar.gz cd pywapi-0.3.8/ python setup.py build sudo python setup.py build
pi@raspberrypi ~ $ sudo pip install --allow-all-external pywapi --allow-unverified pywapi Usage: /usr/bin/pip install [OPTIONS] PACKAGE_NAMES... /usr/bin/pip install: error: no such option: --allow-all-external
ex: /etc/munin/plugin-conf.d/plugins [evohome*] user root
ln -s /usr/local/share/munin/plugins/evohome_ /usr/local/etc/munin/plugins/evohome_Zonename
pi@raspberrypi ~ $ sudo munin-run hallway Traceback (most recent call last): File "/etc/munin/plugins/hallway", line 179, in <module> EvohomeMuninPlugin().run() File "/usr/local/lib/python2.7/dist-packages/munin/__init__.py", line 50, in run values = self.execute() File "/etc/munin/plugins/hallway", line 167, in execute temperature, setpoint, outside_temperature = self.getzoneinfo() File "/etc/munin/plugins/hallway", line 159, in getzoneinfo return temperature, setpoint,outside_temperature UnboundLocalError: local variable 'temperature' referenced before assignment
[evohome*] user root
pi@raspberrypi ~ $ sudo munin-run hallway Traceback (most recent call last): File "/etc/munin/plugins/hallway", line 179, in <module> EvohomeMuninPlugin().run() File "/usr/local/lib/python2.7/dist-packages/munin/__init__.py", line 50, in run values = self.execute() File "/etc/munin/plugins/hallway", line 167, in execute temperature, setpoint, outside_temperature = self.getzoneinfo() File "/etc/munin/plugins/hallway", line 159, in getzoneinfo return temperature, setpoint,outside_temperature UnboundLocalError: local variable 'temperature' referenced before assignment
[evohome*] user root
#ln -s /usr/share/munin/plugins/evohome_ /etc/munin/plugins/evohome_hallway
[evohome*] user root
# munin-run evohome_Woonkamer setpoint.value 16.0 outside_temperature.value 11 temp.value 22.5
# munin-run evohome_Woonkamer config graph_title Room temperature Woonkamer graph_category domotic graph_args --base 1000 graph_vlabel temperature graph_scale yes temp.info Temperature in Room temp.type GAUGE temp.label Temperature setpoint.info Temperature Setpoint in Room setpoint.type GAUGE setpoint.label Temperature SP outside_temperature.info Temperature outside at location outside_temperature.type GAUGE outside_temperature.label Outside Temperature
class Program { static int REFRESH_SECONDS = 300; static void Main(string[] args) { Controller cn = new Controller(); Task t = cn.Init("yourusername", "yourpassword"); t.Wait(); // Set a temp override and cancel again cn.Locations[0].Gateways[0].TemperatureControlSystems[0].Zones[0].SetTemperatureOverride(11, DateTime.Now.AddHours(1)).Wait(); cn.Locations[0].Gateways[0].TemperatureControlSystems[0].Zones[0].CancelTemperatureOverride().Wait(); // Copy the schedule down and writeit back again var st = cn.Locations[0].Gateways[0].TemperatureControlSystems[0].Zones[0].GetSchedule(); st.Wait(); var sched = st.Result; cn.Locations[0].Gateways[0].TemperatureControlSystems[0].Zones[0].SetSchedule(sched).Wait(); // Export data to a csv file using (var s = File.AppendText(@"data.csv")) { foreach (var x in cn.Locations) { foreach (var gateway in x.Gateways) { foreach (var tc in gateway.TemperatureControlSystems) { string line = "Time," + string.Join(",", from z in tc.Zones select z.Name) + "," + string.Join(",", from z in tc.Zones select z.Name); Console.WriteLine(line); s.WriteLine(line); } } } while (true) { Stopwatch sw = new Stopwatch(); sw.Start(); try { cn.UpdateStatus().Wait(); foreach (var x in cn.Locations) { foreach (var gateway in x.Gateways) { foreach (var tc in gateway.TemperatureControlSystems) { string line = DateTime.UtcNow.ToString("HH:mm dd MMM yyyy") + "," + string.Join(",", from z in tc.Zones select z.Status.TemperatureStatus.Temperature) + "," + string.Join(",", from z in tc.Zones select z.Status.HeatSetpointStatus.TargetTemperature); Console.WriteLine(line); s.WriteLine(line); } } s.Flush(); } } catch { } sw.Stop(); Thread.Sleep((int)Math.Max(0,(REFRESH_SECONDS * 1000) - sw.ElapsedMilliseconds)); } } Console.ReadLine(); } }
Comment