genielabs / HomeGenie

HomeGenie, the programmable automation intelligence
https://homegenie.it
GNU General Public License v3.0
389 stars 155 forks source link

CM19a issue #353

Closed alzzy closed 5 years ago

alzzy commented 5 years ago

I am using cm19a in HG on the Pix10hub 1.1 release. Running on Pi Zero W.

I have my cm15a unplugged (also its RF interface is disabled). I have shutdown my Alex10 app and its HA bridge. I have no other x10 software running and the cm19a is my only x10 interface. I use at v572a tranceiver. I have cm19a selected as the x10 interface in HG. Interface function is erratic. If a command is not sent to cm19a for several seconds, it takes two clicks of an x10 module On or Off button in HG for the cm19a to transmit the command. Its like the first click wakes it up and the second transmits the command. I have tried 2 different cm19a's with the same results. Note: my RF connection and v572 transceiver response is very reliable as I have very excellent results with cm19a controlling my devices when running it with Alex10. The other thing I noticed is that it appears the flash of the led on the CM19a when sending a command is shorter in duration when using HG than when using Alex10 if that means anything.

Any help is appreciated!

alzzy commented 5 years ago

FYI, I reported that as issue #354 yesterday

mralapete commented 5 years ago

Guys when you experience a problem with HG you need to run it in debug mode so your actual problem can be identified. There are so many variables at play here like browser type, OS, hardware etc that can cause the issue and not necessarily HG. Do you know how to run it in debug mode and report the issue

@genemars I thought running HG in debug mode and reporting the issue this way was standard procedure. It must be getting very time consuming for you trying to figure out these recent problems without it particularly as you are currently working on a different project.

alzzy commented 5 years ago

Here is some log data. Module Double click log123118.txt

alzzy commented 5 years ago

I did a manual install of stable.30. Still have the double click issue. I did notice that when I single click and the cm19a does not transmit, the flag in the HG gui in the upper right corner comes out after 4 or 5 seconds after the click announcing the command but the cm19a does not respond.

genemars commented 5 years ago

I'm trying this on my laptop and it's working. Whenever I submit a command the CM19 led flashes and the command is performed with no visible delay. So are you both @alzzy and @tuicemen experiencing the same problem? The log @azzly sent looks fine... this is mine:

2019-01-01 13:46:53.0602 Info WebServiceGateway x.x.x.x HTTP    GET 200 /api/HomeAutomation.X10/C6/Control.On/undefined/ [OPEN]
2019-01-01 13:46:53.0602 Debug 20-40-BF-50-AF
2019-01-01 13:46:53.1943 Debug 20-40-BF-50-AF
2019-01-01 13:46:53.3305 Debug 20-40-BF-50-AF
2019-01-01 13:46:53.4665 Info HomeAutomation.X10    C6  X10 Module  Status.Level    1
2019-01-01 13:46:53.4785 Info WebServiceGateway x.x.x.x HTTP    GET 200 /api/HomeAutomation.X10/C6/Control.On/undefined/ [CLOSED AFTER 0,418 seconds]
2019-01-01 13:46:54.6947 Info WebServiceGateway x.x.x.x HTTP    GET 200 /api/HomeAutomation.X10/C6/Control.Off/undefined/ [OPEN]
2019-01-01 13:46:54.6953 Debug 20-40-BF-70-8F
2019-01-01 13:46:54.8263 Debug 20-40-BF-70-8F
2019-01-01 13:46:54.9625 Debug 20-40-BF-70-8F
2019-01-01 13:46:55.0987 Info HomeAutomation.X10    C6  X10 Module  Status.Level    0

If the CM19 led is not flashing then it means the command is not sent for some reason. Have you tried the CM19 on a different system than RPi. Is it working? Is it a RPi-only related issue? Have you tried different house-codes? I see you've been trying with "E" house code, do you have same result trying with a different house code (eg. "A")?

alzzy commented 5 years ago

I have HG installed on a win 10 pc and I do not have this issue with the cm19a. It is very reliable. I do still see it on the RPi. On Win 10 when I send a command the LED flashes and the command is sent and the device responds. I also agree "No flash, no command sent"

alzzy commented 5 years ago

PS, It does not appear to be house code dependent in my case

alzzy commented 5 years ago

Also it appears to be related somehow to the web gui as tuicemen reported he saw the issue with the cm15 when triggered from the browser but that the overnight responses to HA bridge commands were successful. Also I know of another individual using the cm19a on a Pi Zero W with a different sd image and no web gui who gets reliable cm19a performance.

alzzy commented 5 years ago

I thought that this in my earlier post might be a clue " I did notice that when I single click and the cm19a does not transmit, the flag in the HG gui in the upper right corner comes out after 4 or 5 seconds after the click announcing the command but the cm19a does not respond."

genemars commented 5 years ago

@alzzy let's check libusb again from HG folder:

ls -la lib/mib

-rwxrw-r-- 1 gene gene   24064 dic 28 18:06 CM19Lib.dll
lrwxrwxrwx 1 root root      37 gen  1 13:42 libusb-1.0.so -> /lib/x86_64-linux-gnu/libusb-1.0.so.0
-rwxrw-r-- 1 gene gene    6144 set  6 13:34 LibUsb.Common.dll
-rwxrw-r-- 1 gene gene  158208 set  6 13:35 LibUsbDotNet.LibUsbDotNet.dll
-rwxrw-r-- 1 gene gene   50688 dic 29 22:18 MIG.HomeAutomation.dll
-rwxrw-r-- 1 gene gene   31232 set 24 17:56 MIG.Protocols.dll
-rw-r--r-- 1 gene gene 2406991 set 25 16:03 p1db_custom.xml

is the libusb-1.0.so symbolic link pointing to the right location? This might be an issue with with the libusb path in which case also the CM15 driver should be broken.

alzzy commented 5 years ago

Tuicemen, Can you check this> i have no idea how!

mralapete commented 5 years ago

Just type ls -la lib/mig at the Terminal

@genemars I reckon to recreate this problem you will have to install HA Bridge on your Raspberry Pi. Calls are going back and forward between two servers HG and HA Bridge on a fairly low powered Raspberry Pi Zero which could be putting additional strain on the system.

Maybe if the OP ran HA Bridge in debug mode he could establish where exactly the problem lies.

genemars commented 5 years ago

So I just intalled latest raspbian stretch lite on a pi zero (no wireless). I had a few issues with my Wi-Fi dongle and USB keyboard that I resolved using an external powered USB switch. After installing homegenie I tried connecting the CM19. And it was recognized but behaved exactly how you guys described. So I rebooted the Pi with only CM19 and the keyboard attached (no wi-fi dongle this time, no network). Then I typed from console the following commands:

wget http://127.0.0.1/api/HomeAutomation.X10/C7/Control.On
wget http://127.0.0.1/api/HomeAutomation.X10/C7/Control.Off

and it worked as it should have. So the problem is probably the power adapter and the CM19 not designed for low powered devices.

alzzy commented 5 years ago

I am not sure that is a valid conclusion as the issue was also seen with the cm15a which does not rely on the Pi for power. Furthermore , Tuicemen noticed that the system with cm15a ran fine when triggered by the HA bridge but sometimes took a double click when triggered from the web gui. So I don't agree.

genemars commented 5 years ago

@alzzy the cm15 does not rely on usb for powering itself but it will still absorb some power when attached to the usb port. What power supply are you using? Using the web UI will involve network communication, that will require more power I guess. I still believe this might be the cause.

genemars commented 5 years ago

@alzzy I'm now using a 5.2V 1.35A power supply and everything is running fine on a RPi Zero (v1.2 2015) with a 4 port USB switch, TP-link wifi dongle, CM19.

alzzy commented 5 years ago

I am confused. So what is the fix? You saying my 2.5 A 5v supply is not adequate?

genemars commented 5 years ago

@alzzy I'm confused too... it lasted for a few minutes then it hung and I had to reboot. Does anyone tried upgrading mono from xamarin repos? I'm gonna try this too.

alzzy commented 5 years ago

genemars, Let me know what u learn?

genemars commented 5 years ago

This time after the reboot I did wait like 5 minutes before opening the web ui and its working. Not sure if it will last. 🙂

genemars commented 5 years ago

ok... its not mono related. I had issues before installing hg when trying to configure the wifi, the keyboard stopped working once I connected the USB wifi. There were no ways to make the usb keyboard work when the wifi was plugged in. So I unplugged the keyboard and plugged another one (a usb wireless). This one worked even with the wifi plugged in. My conclusion is that might be eitger the rpi firmware buggy or the usb hardware weak.

alzzy commented 5 years ago

Well that explanation doesn't seem to fit either as I know someone using the same hardware but with some what different software and he has excellent performance with cm19.

genemars commented 5 years ago

azzly so I have no clue at all. Anyway my RPi is still working fine since last reboot an hour ago.

alzzy commented 5 years ago

Well I guess I am dead in the water then as they say. The implementation that works using the same hardware is triggered by a voice command via alexa and that appears reliable, in my situation it is triggered by a web gui and it isn't reliable. Does that provide any focus?

mralapete commented 5 years ago

@genemars in all this discussion have you considered that the addition of the HA Bridge server on the same Raspberry Pi Zero W on top of HG is creating an additional load on the low spec Pi processor and memory. The OP should either disable the HA Bridge and run his tests again or move his system to the more powerful Raspberry Pi 3+.

genemars commented 5 years ago

let's try this:

alzzy commented 5 years ago

on the wget is that -O the letter cap. O

genemars commented 5 years ago

@alzzy yes it is uppercase -O.

alzzy commented 5 years ago

i get a 404 error not found

alzzy commented 5 years ago

on the putty screen in response to the wget

genemars commented 5 years ago

@alzzy what port is hg running on?

alzzy commented 5 years ago

8080

genemars commented 5 years ago

so change the url in the wget command accordingly

alzzy commented 5 years ago

geesh, even I shoulda figured that out. LOL ok I am in . Will do a little testing

alzzy commented 5 years ago

No joy! same problem.

alzzy commented 5 years ago

Its like if you give it enough time between toggling a device on or off, the Pi goes to sleep and it takes 1 click to wake it up and a second click to send the command.

alzzy commented 5 years ago

and that time needs to be many seconds, sometimes even longer.

genemars commented 5 years ago

alzzly, tried disabling HA bridge?

alzzy commented 5 years ago

no, how do I do that

alzzy commented 5 years ago

oh in the gui. I can stop the bridge. I will try that!

alzzy commented 5 years ago

No doesn't help

alzzy commented 5 years ago

Do i need to undo the index2 somehow?

genemars commented 5 years ago

@alzzy not necessary. This morning my RPi zero was still running happily with no issues. So the only moment I've been able to reproduce this issue was in the beginning of my tests when I had problems with the USB HUB connector and the power supply. In that case the problems with the USB I/O where already evident even before HomeGenie was installed, any extra device connected to the USB HUB was making the whole system unreliable and slow.

alzzy commented 5 years ago

Gene has put considerable effort into trying to id and correct this issue. I have helped with some of the testing. The results seem to confirm the conclusion that the PiX10 hub is not compatible with the cm19a. It seems to be a systems issue, ie HW + SW, as the cm19a does seem to play well with the Pi Zero w in one known instance where it is used as an Alexa Hub. Or that could be a "Random Success".

alzzy commented 5 years ago

The fact that one user has reported a similar issue with the cm15 is bothersome wrt the PiX10 Hub application.

alzzy commented 5 years ago

Gene, Thanks for all the help with this.

mralapete commented 5 years ago

Gene just to confirm that the CM19 driver is working solid on both the Raspberry Pi Zero W and the Raspberry Pi 3+. HG in general is a lot more responsive on the Raspberry Pi 3+ probably because both the memory is double that of the Raspberry Pi Zero W and the processor is quite a bit faster and there's no need for USB powered hubs.

genemars commented 5 years ago

I just published v1.2-stable.31 which now allow using UPnP library in automation programs. So I created an example program that simulates a Belkin Switch so that Alexa can discover it. Anyone who can test this with Alexa?? To test this:

If we make this work maybe HA bridge will not be required anymore? Right?

1000-UPnP_Test_for_Alexa.hgx.txt

tuicemen commented 5 years ago

@genemars I been tring to fight off a bad christmas virus that got ito my eyes so ive not been able to comment on things as late I'll attemp to test this as soon as I can see straight.

mralapete commented 5 years ago

Initial test of your Belkin Switch program. Alexa not discovering a chosen device