HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Raspberry Pi GPIO/SPI/I2C => Topic started by: Wibo on January 05, 2015, 08:13:54 PM

Title: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 05, 2015, 08:13:54 PM
Hi all,

instead of trying to debug HomeGenie I decided to try the easy way...

I have a hardware temperature sensor on the I2c bus.
It's a Tmp102 and I need to be able to address at least 16 of them.
On the hardware side everything works out untill now.
Succesfully modified raspberry-sharp and HomeGenie is displaying the values.
HomeGenie on raspberry is also propagating events to my win box, which is very cool

So this question is not really about hardware...

I tried to make a decent hgx/module in Configure/Automation/Raspberry by studying the code of the existing ones.

Somehow my module has a problem with names in general.
I can't change the name, the "Update program" is disabled, widget is showing FakeTemperature instead of a nice name
Second line is showing Automation 1003 instead of some useful info.

I see the same behavior in the DHT-11 sensor, but the GPIO module does it the way I like it.
Already played with VirtualModules, because I want the cluster to behave like the GPIO, but wasn't able to make it work yet.
So first I want to have a single sensor perfect, so I'm not writing code based on something crappy.

I have really no idea what I'm doing wrong without starting to debug HomeGenie.
Therefore I made FakeTemperatureSensor that doesn't rely on any hardware dependencies and exposes my problem.
Is it possible with revision 432 or do I need changes elsewhere?

I attached the hgx from the FakeTemperatureSensor anyone should be able to run that.
and a picture of my test case (Tmp102Cluster is my attempt to work with virtual modules it depends on hardware)

Any help will be appreciated.

Best Regards,
Wibo.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 05, 2015, 08:56:50 PM
Hi Wibo,

there must be done a difference between Virtual Modules and Program Modules.

A program module is automatically added by the system and associated to each program.
This can have a specific display widget when calling Program.AddControlWidget (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#a8db23c8895fe3b22b9b3dd2697486c8c). The program module inherits the program name and other program parameters and these cannot be changed by the user unless these are configuration options (see AddInputField (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#a7ba04163f85d61d47297601bd28c84f7) method).

A virtual module is added by Program.AddVirtualModule (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#ad74a2a82101dd80e17244fd03eaf181f) or Program.AddVirtualModules (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html#a6ce0c82ab9edb50be6689919cf29c1ca) and it is a generic module fully user-configurable.
Virtual modules parameters are updated by programs by using the Program.RaiseEvent method.
See Program Helper Documentation (http://www.homegenie.it/docs/doxy/de/d1f/class_home_genie_1_1_automation_1_1_scripting_1_1_program_helper.html) for more informations about how to use these commands.

Also take a look at this discussion:
http://www.homegenie.it/forum/index.php?topic=586.msg3392#msg3392 (http://www.homegenie.it/forum/index.php?topic=586.msg3392#msg3392)
it might contains other useful informations.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 05, 2015, 09:05:53 PM
Hi Gene,

thanks for the pointers, I didn't realize the fundamental difference between Virtual Modules and Program Modules.
The forum thread was new to me too.

I'm on it, let you know the result.

Best regards,
Wibo.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 05, 2015, 09:07:12 PM
Please read again the post because I edited it and hopefully better described how it works. =)

g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 05, 2015, 10:05:40 PM
Reread the message, think I'll take GPIO Modules as a template this time, instead of adding virtual modules to a DHT-11 Program module.

Will take some time, work and family comes first.

Let you know...
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 10, 2015, 07:48:26 PM
Hi Gene,

yesterday I finished the FakeTemperatureCluster, it all works like intended.
Don't know if you can make time to review the hgx, I want to be sure I have a proper foundation for the real stuff I'm going to make. The FakeTemperatureCluster does not depend on any hardware and should run on Mac,Windows,Linux.

Thanks for your explanation about the modules, that was the missing part.

By the way, is it appreciated when I start a new thread where I report the progress of my project?
It would contain lots of info about the hardware I use, how to setup, etc.
If yes, should I do it in "Stories" or "Raspberry Pi GPIO/SPI/I2C" or somewhere else

Best regards,
Wibo.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 11, 2015, 09:50:24 PM
Hi all,

When testing the hgx from the previous post I have some issues that worries me.

My setup:
I had FakeTemperatureSensorCluster running at raspberry pi B+ r431 with 3 fake sensors active
HomeGenie on the Pi interconnects with a windows box
On the windows box r394 I use HomeGenie to log the temperature sensor events to a file

Issue 1
The CPU utilization on the Pi (using top in a terminal window) for the mono process is between 40 and 80% when I activate my sensors, when I disable the sensors the load is around 10%

Issue2
Sometimes a widget is not updating (skipping an event) after skipping it continues as usual.
The log file I'm writing to file misses a lot of samples, I'm firing the events fast in the order Sensor1, Sensor2, Sensor3. Looking at the file it almost seems that the last event (Sensor3) is eating the other events when it feels like it.

Snapshot of my logfile:
11-1-2015 20:21:24;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;33.3
11-1-2015 20:21:25;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;34.4
11-1-2015 20:21:26;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;35.5
11-1-2015 20:21:27;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;36.6
11-1-2015 20:21:28;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;37.7
11-1-2015 20:21:29;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;38.8
11-1-2015 20:21:30;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;28.8
11-1-2015 20:21:30;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;39.9
11-1-2015 20:21:32;RaspberryPi.FakeTSC;Boiler;Sensor1;19.9
11-1-2015 20:21:32;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;31.1
11-1-2015 20:21:33;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;21.1
11-1-2015 20:21:34;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;22.2
11-1-2015 20:21:35;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;23.3
11-1-2015 20:21:35;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;34.4
11-1-2015 20:21:37;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;35.5
11-1-2015 20:21:38;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;36.6
11-1-2015 20:21:39;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;26.6
11-1-2015 20:21:39;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;37.7
11-1-2015 20:21:40;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;27.7
11-1-2015 20:21:40;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;38.8
11-1-2015 20:21:41;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;39.9
11-1-2015 20:21:42;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;30
11-1-2015 20:21:43;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;20
11-1-2015 20:21:43;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;31.1
11-1-2015 20:21:44;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;32.2
11-1-2015 20:21:44;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;32.2
11-1-2015 20:21:45;RaspberryPi.FakeTSC;HeatEx cold water inlet;Sensor2;22.2
11-1-2015 20:21:45;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;33.3
11-1-2015 20:21:46;RaspberryPi.FakeTSC;Boiler;Sensor1;12.2
11-1-2015 20:21:46;RaspberryPi.FakeTSC;HeatEx cold H2o outlet;Sensor3;34.4

Does anyone know what's going on here?
I really hope I'm doing something stupid.

Best regards,
Wibo.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: dani on January 11, 2015, 11:18:15 PM
You have made a too short Pause by default : 1 seconde.
A real sensor doesn't send so much report, only one sometimes when the difference of tempertaure is big enough. And one global report every 2 hours (Batterie,Level of reception).
For sample it's send a tempreture report every 1° difference or less. Generally it's possible to set this value in the sensor in Zwave for exemple.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: dani on January 12, 2015, 10:39:46 AM
Hi Wibo,

Here I join a HGX program based on your, but I add Switchs virtual for change variation up or down and random variations of temperature.
For use those switchs, you can use my APP CPNTRIBUTION : A multi thermostats program with calendar and hour tables : http://www.homegenie.it/forum/index.php?topic=591.0 (http://www.homegenie.it/forum/index.php?topic=591.0)

Cheers
Dani
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 12, 2015, 07:46:00 PM
Hello Dani,

thanks a lot for your reply.

The advise to lower the UpdateInterval to 30 seconds will not work for me.
Let me explain...

I'm preparing software to build a heat boiler system.
That means monitoring the temperatures of a lot of pipes that can change temperature very rapidly.
I need process control, it doesn't have to be realtime as in microseconds or milliseconds.
I was planning to only send events when the temperature is really changing, but before that I had to test the worst case scenario.

My worst case scenario is between 8 and 16 sensors updating every second and I'm getting into trouble before even reaching the needed count of sensors.

The event system must be 100% reliable.

Imagine a scenario with a smoke sensor or a sensor for your security system generating an event that gets lost just because some random sensor is sending an event at the same time.

I really hoped I made a mistake, because if HomeGenie is not capable of reliably sending at least 20 events per second it can't be used for a heat boiler.
In addition to that, if HomeGenie looses events that have different values every time, I doubt if
it's suitable for the HomeAutomation that I have in mind, reliability is number one priority.

This would really be a big disappointment for me, because I like the way HomeGenie is designed and I really didn't see this one coming.

BTW: I played with Sleep(100) which makes the loss of event more balanced over the 3 sensors, but still a lot of events get lost.

Thanks for the time you invested, appreciate that.

Best regards,
Wibo.

Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 12, 2015, 09:27:50 PM
Hi Wibo,

the update interval can also be 1 seconds, it doesn't really affect performance.
I'm just wondering, where are you getting logs from?
I ran your script on a RPi model B and this is local log with 3 sensors:
Code: [Select]
2015-01-12T20:17:28.2259890+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -34.4500000000006
2015-01-12T20:17:28.2665130+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -34.4500000000006
2015-01-12T20:17:28.2871880+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -34.4500000000006
2015-01-12T20:17:29.3177850+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -33.3500000000006
2015-01-12T20:17:29.3321710+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -33.3500000000006
2015-01-12T20:17:29.3624330+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -33.3500000000006
2015-01-12T20:17:30.4461970+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -32.2500000000006
2015-01-12T20:17:30.4715430+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -32.2500000000006
2015-01-12T20:17:30.5099760+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -32.2500000000006
2015-01-12T20:17:31.5815720+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -31.1500000000006
2015-01-12T20:17:31.6093620+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -31.1500000000006
2015-01-12T20:17:31.6569370+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -31.1500000000006
2015-01-12T20:17:32.7092700+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -30.0500000000006
2015-01-12T20:17:32.7595650+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -30.0500000000006
2015-01-12T20:17:32.8088950+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -30.0500000000006
2015-01-12T20:17:33.8195680+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -28.9500000000006
2015-01-12T20:17:33.8608520+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -28.9500000000006
2015-01-12T20:17:33.8715230+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -28.9500000000006
2015-01-12T20:17:34.9529130+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -27.8500000000006
2015-01-12T20:17:34.9821370+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -27.8500000000006
2015-01-12T20:17:35.0203120+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -27.8500000000006
2015-01-12T20:17:36.0834640+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -26.7500000000006
2015-01-12T20:17:36.1084540+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -26.7500000000006
2015-01-12T20:17:36.1413100+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -26.7500000000006
2015-01-12T20:17:37.2018960+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -25.6500000000006
2015-01-12T20:17:37.2818380+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -25.6500000000006
2015-01-12T20:17:37.3222320+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -25.6500000000006
2015-01-12T20:17:38.3876050+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -24.5500000000006
2015-01-12T20:17:38.4022360+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -24.5500000000006
2015-01-12T20:17:38.4322370+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -24.5500000000006
2015-01-12T20:17:39.5113310+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -23.4500000000006
2015-01-12T20:17:39.5567520+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -23.4500000000006
2015-01-12T20:17:39.5631630+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -23.4500000000006
2015-01-12T20:17:40.6054090+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -22.3500000000006
2015-01-12T20:17:40.6410370+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -22.3500000000006
2015-01-12T20:17:40.6820690+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -22.3500000000006
2015-01-12T20:17:41.6927050+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -21.2500000000006
2015-01-12T20:17:41.7224230+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -21.2500000000006
2015-01-12T20:17:41.7423220+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -21.2500000000006
2015-01-12T20:17:42.8119150+00:00 RaspberryPi.FakeTSC Sensor1 Virtual Module Sensor.Temperature -20.1500000000006
2015-01-12T20:17:42.8335660+00:00 RaspberryPi.FakeTSC Sensor2 Virtual Module Sensor.Temperature -20.1500000000006
2015-01-12T20:17:42.8823980+00:00 RaspberryPi.FakeTSC Sensor3 Virtual Module Sensor.Temperature -20.1500000000006
No event loss here.

If you are using Interconnections and logging from another box you shouldn't be using "Forwarding" because it's based on HTTP and HG http server has a limited number of threads managed by using the Net ThreadPool... and it also has a kind of flood protection.
The proper way of handling such kind of high reliable and real time interconnection is using MQTT instead. Then you won't loose any event =)

Cheers,
g.

Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 12, 2015, 09:36:54 PM
To setup MQTT, you have to install the mqtt broker on one computer in your network (can be your Win or the RPi box as well) and enable on both HomeGenie servers the MQTT client app (perhaps recompile before enabling it and also disable any "Forwarding" app).
For installing mosquitto (mqtt broker) on raspberry just do a:
sudo apt-get install mosquitto
Then you can choose what modules to publish and share on your MQTT network.
If you are curious to see how HG communicates over MQTT, you can also install the mqtt client app and see the "conversation" between the HG boxes:
sudo apt-get install mosquitto-clients
(mosquitto-clients - Mosquitto command line MQTT clients)

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 12, 2015, 10:40:52 PM
Hi Gene,

thanks for the reply.

You want to know where I get the logs from...
RPiB+ cell generates the event via an interconnect to a win7 cell which has a hgx using FileStream and TextWriter to create the file, I'm not gonna post it, because it's crappy code just to test my worst case scenario.

If anyone is interested I can cleanup the code and post it.

What you write is awesome, I had no idea about the limitations of forwarding by using an interconnect to another HG cell (It was fast and easy to setup).
Already read a few things about MQTT and the features it offers. Going to start reading all documentation you already have about MQTT and try to setup.

Appreciate your help Gene, thanks a lot!

I'll keep you updated...

Best regards,
Wibo.









Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 13, 2015, 12:04:29 AM
Can confirm that on the RPi side events don't get lost, all events are logged, still having the interconnection active, firing 3 events in a row every second, the RPi is only behind quite a bit.

Next step will be killing interconnection/forwarding and get me a MQTT broker online.

To be continued...

Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 13, 2015, 12:06:45 AM
Forgot to post the cleanup log ;(

2015-01-12T23:44:02.8495690+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   14.4
2015-01-12T23:44:02.9659140+01:00   RaspberryPi.FakeTSC   Sensor2   Virtual Module   Sensor.Temperature   25.5

2015-01-12T23:44:03.1088910+01:00   RaspberryPi.FakeTSC   Sensor3   Virtual Module   Sensor.Temperature   35.9499999999994

2015-01-12T23:44:04.2200580+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   15.5
2015-01-12T23:44:04.3468800+01:00   RaspberryPi.FakeTSC   Sensor2   Virtual Module   Sensor.Temperature   26.6
2015-01-12T23:44:04.4706420+01:00   RaspberryPi.FakeTSC   Sensor3   Virtual Module   Sensor.Temperature   37.0499999999995

2015-01-12T23:44:05.5781020+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   16.6
2015-01-12T23:44:05.7156050+01:00   RaspberryPi.FakeTSC   Sensor2   Virtual Module   Sensor.Temperature   27.7
2015-01-12T23:44:05.8265060+01:00   RaspberryPi.FakeTSC   Sensor3   Virtual Module   Sensor.Temperature   38.1499999999995

2015-01-12T23:44:06.9362400+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   17.7

2015-01-12T23:44:07.0696740+01:00   RaspberryPi.FakeTSC   Sensor2   Virtual Module   Sensor.Temperature   28.8
2015-01-12T23:44:07.1847650+01:00   RaspberryPi.FakeTSC   Sensor3   Virtual Module   Sensor.Temperature   39.2499999999995

2015-01-12T23:44:08.2958020+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   18.8
2015-01-12T23:44:08.4308740+01:00   RaspberryPi.FakeTSC   Sensor2   Virtual Module   Sensor.Temperature   29.9
2015-01-12T23:44:08.5735160+01:00   RaspberryPi.FakeTSC   Sensor3   Virtual Module   Sensor.Temperature   30
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 13, 2015, 12:25:33 AM
an online server is: http://test.mosquitto.org/ (http://test.mosquitto.org/)

I've been using this one for early testing. Off course all messages will be public and visible to all other connected clients, so this is just for testing purpose.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 13, 2015, 10:24:57 PM
Hi all,

installed MQTT broker mosquitto-1.3.5
Followed instructions and got the event system working.
Events are still lost in the homegenie box/cell that receives the events.
Events are generated at a speed of one per second.

Gene I'll provide you a a decent report, but I need more time to do tests and write the report.

Best regards,
Wibo.


Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 14, 2015, 08:05:33 PM
Hi all,

this is my test report for using MQTT with HomeGenie.

Setup:

Win7 pro box running in vmware workstation upgraded with latest HG r447 (394 didn't have MQTT)
Don't forget to backup, the windows installer forces you to uninstall and everything gets lost unless
you have a backup.
Enabled MQTT and forgot to recompile.
Did some other stuff and noticed the webbrowser indicated a restart of HG once in a minute or so.
After recompiling MQTT HG was stable.
When both boxes were configured and some restarts/recompiles/etc. of HG were done (don't remember the
exact order) events arrived and the module was added.


RPi B+ box with downloaded HG image revision 431, I modified all raspberry-sharp IO binaries
Tried to disable all modules that could cause events.
Disabled interconnections, enabled MQTT and yes you really need to recompile before it connects.
Enabled the FakeTemperatureSensorCluster with only one sensor sending one event per second.
CPU utilization was about 5% peeks to 30% (I need a graphical tool)

End Setup


So I started testing...

I throwed away every html/threadpoollimit/overfloodprotection thing I could think of...
In other words:
Closed all browsers and deleted all widgets, checked if the interconnection were still disabled.
Disabled all polling sensors except for one sensor generating an event every second.
Booted RPi and Win7 box to get a clean start.

Facts:
RPi is logging every event, tail of the homegenie.log is attached as RPiboxHomeGenieLog.txt
Win7 misses events in the homegenie.log, attached as Win7boxHomeGenieLog.txt

That's the end of test day 1


When I came home next day and started testing, the http server on the RPi was down.
(SSH)Putty was working and top didn't show mono anymore, obviously HG had died.
Copied(WinSCP) the tail of the homegenie.log into RPiHttpServerDown.txt which is attached.
This was the first time in weeks HG died on RPi, normally it's rocksolid.
Rebooted the RPi and everything was fine again.

So, what am I going to do now?

Find out what's causing the nasty mqtt exception in de logs.
Install the mqtt client app to see if the events are arriving at the mqtt broker.
Let win7 box send events to see if there's anything different.
Debug code in win7 box if it has the same problem
Update boxes to last revision.

Don't know what and in what order I should test, still a newbie.
Any pointers are welcome.

Think curiosity wins and mqtt client app gets installed first, results will be posted.

Best regards,
Wibo.

Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 14, 2015, 09:38:34 PM
What MQTT broker are you using? Where is it running on?
I think you did too much things =) Just to make this simple:

1) install HG
2) recompile MQTT client app and configure server address and port, then start the app
3) enable the flag "publish on mqtt network" on modules you want to share with the other HG-MQTT clients
4) on the other HG (after at least one event is sent from modules on the publishing HG) you will be able to pick remote modules from the modules list

that's it. No need to touch anything else if you're coming from a fresh HG install.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 14, 2015, 10:44:56 PM
Hi Gene,

sorry forgot to mention the MQTT broker, it's Mosquitto on the win7 box.

Already considered a fresh install on RPi, fresh install on win7 didn't change anything.

I've been testing a few things and the report is almost finished...
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 14, 2015, 10:50:21 PM
Hi Gene,

figured out how to monitor mqtt and the result was surpising.

Used: C:\Program Files\mosquitto\mosquitto_sub.exe -d -t #

The # is a wildcard that shows ALL messages.

Messages came in at bursts, time between bursts 1-2 sec and sometimes 5-6 sec
Every burst was large like in 30kB and the size of the bursts increased every burst.
This is not good for a "realtime" system

Since the message contained "Statistics" I wanted to disable Statistics in HG.
Untill now I don't know how to disable that.

Attached is one single burst of data.

Think I will try fresh install on RPi tomorrow or find a way to disable statistics.

Best regards,
Wibo.


Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 14, 2015, 11:02:13 PM
Please try upgrading to r453 by using update manager.
If Statistics fields is still there, this is a bug. It shouldn't be serialized. Anyway, only first time the whole module structure is sent, after that only one line for each new event should be sent.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 14, 2015, 11:09:15 PM
Well... I confirm this is a bug. I already fixed it, but if you want file a issue on github just to keep track of it.
Thanks for helping with this =)

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 15, 2015, 03:32:02 PM
Hi Wibo,

the MQTT fix is available in r455. This can be obtained from source code only at the moment:

https://github.com/genielabs/HomeGenie

as there's some work in progress involving other topics, the update will be pushed later, before the end of the month I suppose.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 15, 2015, 07:15:06 PM
Hi Gene,

thanks for your effort!

Checked HG at the RPi when I came home, it was dead again, so the crash is reproducible.

Last 2 lines of the HG log:
2015-01-15T15:39:07.8760580+01:00   RaspberryPi.FakeTSC   Sensor1   Virtual Module   Sensor.Temperature   16.6
2015-01-15T15:39:08.2744460+01:00   HomeAutomation.HomeGenie   UnhandledExceptionTrapper   System.IO.IOException: Write failure ---> System.Net.Sockets.SocketException: The socket ha

Going to make an attempt to upgrade to rev 455, sooner or later I have to learn this anyway.
I'm used to svn and already have your code checked out some time ago, so no problems there.

I'm only doubting what would be the most efficient approach.
I already did an "xcopy deployment" when I modified the raspberry-sharp.io, but never with all the HG binaries and if the database design has changed this won't work.
I have the rev 432 code compiling in VS2010 only had to fix a few issues that were not compatible with VS2010.

I could also try to create an install package after reading your docs about that again.

I could also try to update to the r453 and try xcopy deployment after that.

Any advice?

Best regards,
Wibo.


Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 15, 2015, 11:21:18 PM
Wibo,

just wondering why did you need modifying raspberry-sharp-io?
Btw there's an HG specific fork:

https://github.com/genielabs/raspberry-sharp-io

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 15, 2015, 11:30:15 PM
Hi all,

using vs2010
updated to r455
fixed merge conflict with raspberry-sharp.IO
changed 4.5 into 4.0 (TargetFrameworkVersion) in Windows.csproj
Rebuild all Succeeded

Kinda stuck with building the RPi image, the Packager in the HomeGenie_Linux solution does not build, the only options are reload and delete.
VS2010 doesn't like it when starting up.

I started a thread to find out what you're using, this thread is already messy enough.

Best regards,
Wibo.

Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 15, 2015, 11:34:29 PM
Hi Gene,

I needed hardware support for a temperature sensor that was not supported, a sensor that could do things others could not.

128 sensors on I2c on one raspberry pi theoretical.

Asked you already if you wanted me to post a story of the project and where...

Best regards,
Wibo.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Gene on January 16, 2015, 01:07:07 AM
Off course you can post the story if you want. In the "Story" discussion board and/or in the HomeGenie G+ community.
Hopefully we will make it work with HG.

Cheers,
g.
Title: Re: Temperature sensor widget's cannot be "named"
Post by: Wibo on January 16, 2015, 07:00:32 PM
I'm very confident we can make it work else I wouldn't spend so much time. ;)

I will soon start a thread in the story discussion board, so everybody can read what I'm trying to accomplish.

FYI:
Yesterday evening I disabled MQTT after booting RPi and HG was still running when I came home today.

Going to setup a clean HG vmware, because my current one is pretty messy after testing so many domotica projects and IDE's.

regards,
Wibo.