etcipnja / MLH

[FARMWARE] Mother's little helper
MIT License
5 stars 6 forks source link

Error with new version #4

Closed derletztename closed 6 years ago

derletztename commented 6 years ago

Hi Eugene, thanks for updating your great MLH. For reasons I don't understand it does not run. I switched from the online server to a local version as I am very offgrid with my farmbot and there always was an issue with the roaming data amount. So it's the first time I try your new farmware and your farmware on my new server. But I guess the server should not be a problem? I tried to reconnect as suggested, it does not help.

mlh_error
etcipnja commented 6 years ago

Hello, this means the API_TOKEN that your raspberry pi gave to firmware is not good for your server

Did you try other Farmware? The problem shall be universal

Eugene

derletztename commented 6 years ago

Thank you for the comment. I only tried the "first-party", the original farmware like "take photo". This one worked fine. Is this a hint that farmware works in general or do you suggest to test another "selfmade" farmware?

derletztename commented 6 years ago

After talking to a coder friend and looking here: [(https://developer.farm.bot/docs/farmware)]: Do I have to do something on a local server to get non first party farmwares to run? Maybe set the API token somehow myself?

AscendFB commented 6 years ago

Looks like the MLH farmware sends the token request directly to "my.farmbot.io". @derletztename Sadly I don't have a local server running. You would need to test out some fixes for us.

@etcipnja I forked your MLH repository. If it works I'll open a pull request :)

derletztename commented 6 years ago

Hi again, I had some other issues while trying to update my local server as recommended by RickCarlino, which failed at first because of github merging issues. Now it's up to date, but still the same error for MLH. I also tested the selfie farmware and got the same error. I'd love to try out your suggestions, I just hope it doesn't kill the farmbot. I mostly can't repair it myself softwarewise ;) @etcipnja so you don't use your own server local either?

Klimbim1 commented 6 years ago

Hoi gents, having similar issues with MLH, see FB forums as well...

etcipnja commented 6 years ago

@AscendFB you right. I send it directly to "my.farmbot.io". I am currently on vacation and don't have access to my dev platform. Try to see where I assign ""my.farmbot.io" to a variable. Somewhere around this code I decode this URL from API_TOKEN, but I am not using it, instead I assign the hardcoded value. This is not compatible with the local server.

etcipnja commented 6 years ago

@derletztename I am not using local server.

derletztename commented 6 years ago

I hope you have a great vacation and also be back soon ;) :D

derletztename commented 6 years ago

So is it just line 98 self.api_url='https://my.farmbot.io/api/' in Farmware.py, that has to be changed and it would run on a local machine?

etcipnja commented 6 years ago

@derletztename Hi, I am back home! I don't have a local server but if I understand the issue correctly you just need to uncomment the first line and comment the second. '''

self.api_url = 'https:'+token['iss']+'/api/'

self.api_url='https://my.farmbot.io/api/' ''' probably you already figured it out. I am still catching up with my staff and will post the official update after more testing.

Thank you, Eugene

etcipnja commented 6 years ago

2.4.13 shall fix this issue. I am unable to verify it because I do not run the local server. However I am getting the URL from the API_KEY now and it shall fix it.

derletztename commented 6 years ago

Thx so much Eugene. I will try this out and give feedback. Right now my farmbot server is at home because I can't figure out why it keeps crashing, something with the both services running and losing contact to each other maybe (https://forum.farmbot.org/t/local-webserver-failure/3689/14). But it will be back on the field soon

derletztename commented 6 years ago

I tried it out today and got this error. But also the server crashed again shortly after, so I am not 100% sure what is the reason for the farmware error. mlh_error

Do you know what the error message means, what caused that error? That would be helpful anyways

etcipnja commented 6 years ago

@derletztename I am puzzled. Never saw this error before. Looks like very basic problem - this exception happened before Farmware was able to print anything.

derletztename commented 6 years ago

Tried it again and am certain, that the server has not crashed this time. Same error. Though I guess, the Homebrew Server work with http instead of https and therefore there is the SSL error coming up. Maybe exchaning https with http in the code migth do the trick?

mlh_error_2

I have forked a version and changed it and will head of the the field to test it now

derletztename commented 6 years ago

Yes, exchanging https with http makes it working for self hosted servers :)

etcipnja commented 6 years ago

@derletztename I tried to drop https in the farmware - it doesn't work for the hosted solution. So if you want to use MLH with your private server (and probably other farmwares) you have 2 options:

The later is the right way to go, but it will be not piece of cake. On the positive note - you'll get a lot of new knowledge. Heads-up: self signed certificate would require to install root certificate on all devices you plan to use as a client (otherwise security exception will be generated). Probably the most straightforward way would be to spend some money in order to get the certificate from a trusted source.

Thank you, Eugene