automation - ansible - sync of rules
Moderators: grovkillen, Stuntteam, TD-er
automation - ansible - sync of rules
Hello,
I have about 10 nodemcus / wemos with easyesp in my house.
for connectivity problems and also for reporting I have created some rules and also to keep wifi backup ssid config etc in sync I would like to have some orchestration of all of them to keep at least 1 rule set in sync and also all other basic settings.
From technical perspective ansible would do the job, however I am not very familiar with ansible, so can someone provide how to access the nodemcus. Even more as I do not find the config parameters as API call....
Thanks for examples...
I have about 10 nodemcus / wemos with easyesp in my house.
for connectivity problems and also for reporting I have created some rules and also to keep wifi backup ssid config etc in sync I would like to have some orchestration of all of them to keep at least 1 rule set in sync and also all other basic settings.
From technical perspective ansible would do the job, however I am not very familiar with ansible, so can someone provide how to access the nodemcus. Even more as I do not find the config parameters as API call....
Thanks for examples...
Re: automation - ansible - sync of rules
Some commands, especially for configuration, are not accessible directly from a url (like /cmd=taskenable%2C6 etc.), but you can run a rule, with arguments, from that url, /cmd=event%2CupdateGeneralConfig%3Dtest1%2Ctest2%2Ctest3 (command: event,updateGeneralConfig=test1,test2,test3)
Then, in your rules you can handle that input:
Then, in your rules you can handle that input:
Code: Select all
on updateGeneralConfig* do // Add * to handle 1st argument as string
WiFiSSID2,%eventvalue1% // Secondary SSID name
WiFiKey2,%eventvalue2% // Secondary SSID password
// etc.
Save // Persist settings
endon
/Ton (PayPal.me)
Re: automation - ansible - sync of rules
thanks Ath!
so my idea is to have one scratch rule file, eg rules4.txt and then question is how to update or upload this specific rule file to all easyesp hosts and then I can execute the file on all systems...
2 step approach...
any hint how to get the file from remote to each easyesp host?
so my idea is to have one scratch rule file, eg rules4.txt and then question is how to update or upload this specific rule file to all easyesp hosts and then I can execute the file on all systems...
2 step approach...
any hint how to get the file from remote to each easyesp host?
Re: automation - ansible - sync of rules
There is an experimental feature called FEATURE_CUSTOM_PROVISIONING, which is not yet included in official builds.
Only in custom builds.
This allows to download files from a HTTP server using a command.
So then you could define the URL in the rules and the settings archive page and issue an event to trigger the download of the file.
The command (to call from within the rules) is then "provisionrules" to fetch a rules file.
But like I said, it is not yet available in official builds.
Only in custom builds.
This allows to download files from a HTTP server using a command.
So then you could define the URL in the rules and the settings archive page and issue an event to trigger the download of the file.
The command (to call from within the rules) is then "provisionrules" to fetch a rules file.
But like I said, it is not yet available in official builds.
Re: automation - ansible - sync of rules
cool function!
However I always get a timeout of the rules4.txt file.
If I use the URL http://172.30.1.10/rules4.txt in the browser I see the file content...
In the syslog of the nodemcu I see after executing following command: curl http://172.30.1.57/control?cmd=ProvisionRules,4
Aug 25 22:06:00 ESP-Easy EspEasy: EVENT: Clock#Time=Thu,20:06
Aug 25 22:06:00 ESP-Easy EspEasy: EVENT: Clock#Time=Thu,20:06 Processing time:3 milliSeconds
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP after parseTemplate: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: Command: ProvisionRules
Aug 25 22:06:02 ESP-Easy EspEasy: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: Par1: 4 Par2: 0 Par3: 0 Par4: 0 Par5: 0
Aug 25 22:06:02 ESP-Easy EspEasy: CRC : ProvisioningSettings CRC ...OK
Aug 25 22:06:02 ESP-Easy EspEasy: downloadFile: URL: http://172.30.1.10/rules4.txt decoded: 172.30.1.10:80/rules4.txt
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP : DownloadFile 172.30.1.10 GET... HTTP code: 200
Aug 25 22:06:04 ESP-Easy EspEasy: Timeout: rules4.txt
Aug 25 22:06:04 ESP-Easy EspEasy: sendcontent free: 16752 chunk size:19
Aug 25 22:06:04 ESP-Easy EspEasy: sendcontent free: 13552 chunk size:0
Aug 25 22:06:04 ESP-Easy EspEasy: EVENT: http#172.30.1.10=200
Aug 25 22:06:05 ESP-Easy EspEasy: EVENT: http#172.30.1.10=200 Processing time:82 milliSeconds
As easyesp SW I use: ESP_Easy_mega_20220809_custom_beta_ESP8266_4M1M
As URL I have configured: http://172.30.1.10 (and have checked "Fetch rules4.txt:").
apache logs looks good as well (no authentication required)
172.30.1.57 - - [25/Aug/2022:22:10:15 +0200] "GET /rules4.txt HTTP/1.1" 200 306 "-" "ESP Easy/20116/Aug 9 2022 09:52:15"
any idea?
However I always get a timeout of the rules4.txt file.
If I use the URL http://172.30.1.10/rules4.txt in the browser I see the file content...
In the syslog of the nodemcu I see after executing following command: curl http://172.30.1.57/control?cmd=ProvisionRules,4
Aug 25 22:06:00 ESP-Easy EspEasy: EVENT: Clock#Time=Thu,20:06
Aug 25 22:06:00 ESP-Easy EspEasy: EVENT: Clock#Time=Thu,20:06 Processing time:3 milliSeconds
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP after parseTemplate: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: Command: ProvisionRules
Aug 25 22:06:02 ESP-Easy EspEasy: ProvisionRules,4
Aug 25 22:06:02 ESP-Easy EspEasy: Par1: 4 Par2: 0 Par3: 0 Par4: 0 Par5: 0
Aug 25 22:06:02 ESP-Easy EspEasy: CRC : ProvisioningSettings CRC ...OK
Aug 25 22:06:02 ESP-Easy EspEasy: downloadFile: URL: http://172.30.1.10/rules4.txt decoded: 172.30.1.10:80/rules4.txt
Aug 25 22:06:02 ESP-Easy EspEasy: HTTP : DownloadFile 172.30.1.10 GET... HTTP code: 200
Aug 25 22:06:04 ESP-Easy EspEasy: Timeout: rules4.txt
Aug 25 22:06:04 ESP-Easy EspEasy: sendcontent free: 16752 chunk size:19
Aug 25 22:06:04 ESP-Easy EspEasy: sendcontent free: 13552 chunk size:0
Aug 25 22:06:04 ESP-Easy EspEasy: EVENT: http#172.30.1.10=200
Aug 25 22:06:05 ESP-Easy EspEasy: EVENT: http#172.30.1.10=200 Processing time:82 milliSeconds
As easyesp SW I use: ESP_Easy_mega_20220809_custom_beta_ESP8266_4M1M
As URL I have configured: http://172.30.1.10 (and have checked "Fetch rules4.txt:").
apache logs looks good as well (no authentication required)
172.30.1.57 - - [25/Aug/2022:22:10:15 +0200] "GET /rules4.txt HTTP/1.1" 200 306 "-" "ESP Easy/20116/Aug 9 2022 09:52:15"
any idea?
Re: automation - ansible - sync of rules
What version of the code do you use?
It looks like it is still using the old code, which I merged a fix for today.
See: https://github.com/letscontrolit/ESPEasy/pull/4205
I did not check the download call myself in this latest code, but given you are seeing the timeout, I guess it is still the "old" code I was working on yesterday.
You can download a GitHub Actions test build including these fixes here: https://github.com/letscontrolit/ESPEas ... 2925712474
N.B. You need to be logged in into GitHub to download the "Binaries" right under the header "Artifacts"
It looks like it is still using the old code, which I merged a fix for today.
See: https://github.com/letscontrolit/ESPEasy/pull/4205
I did not check the download call myself in this latest code, but given you are seeing the timeout, I guess it is still the "old" code I was working on yesterday.
You can download a GitHub Actions test build including these fixes here: https://github.com/letscontrolit/ESPEas ... 2925712474
N.B. You need to be logged in into GitHub to download the "Binaries" right under the header "Artifacts"
Re: automation - ansible - sync of rules
great support thanks, so I installed following version:
ESP_Easy_mega_20220825_custom_beta_ESP8266_4M1M
However same timeout behavior
ESP_Easy_mega_20220825_custom_beta_ESP8266_4M1M
However same timeout behavior
Re: automation - ansible - sync of rules
Thanks for the feedback.
I will try it myself and see whether I missed a specific use case there.
Will get back to you.
I will try it myself and see whether I missed a specific use case there.
Will get back to you.
Re: automation - ansible - sync of rules
and I miss the notification menu, are you aware of this topic, nevertheless notifications are working....
Re: automation - ansible - sync of rules
Yep I am aware and it is on my todo-shortlist.
But as you may have seen by the nr of commits the last few days, I've also been busy on other parts of the code.
Since there was quite a serious issue on some ESP32 boards, I plan on making a new build soon and I will also try to fix your download issue and have it included in that build too.
But as you may have seen by the nr of commits the last few days, I've also been busy on other parts of the code.
Since there was quite a serious issue on some ESP32 boards, I plan on making a new build soon and I will also try to fix your download issue and have it included in that build too.
Re: automation - ansible - sync of rules
no hurry...
Re: automation - ansible - sync of rules
days are getting shorter, so asking for any update?
Re: automation - ansible - sync of rules
Have not yet tested the download feature myself, but I have been making quite some code changes in that department.
Perhaps you could test this (pending) PR: https://github.com/letscontrolit/ESPEas ... 3218259124
N.B. it also includes some first implementation of mine to add NTP-like support via p2p nodes, so you might see "strange" system times when the node cannot reach a NTP server itself but is having the same UDP port configured on multiple nodes in the network (still working on that fix)
Edit:
Just browsing through the previous posts...
How quickly may the host reply which is serving the files? Maybe it is just a simple fix to increase the timeout?
Perhaps you could test this (pending) PR: https://github.com/letscontrolit/ESPEas ... 3218259124
N.B. it also includes some first implementation of mine to add NTP-like support via p2p nodes, so you might see "strange" system times when the node cannot reach a NTP server itself but is having the same UDP port configured on multiple nodes in the network (still working on that fix)
Edit:
Just browsing through the previous posts...
How quickly may the host reply which is serving the files? Maybe it is just a simple fix to increase the timeout?
Re: automation - ansible - sync of rules
as I have problems with OTA of the nodemcu with the beta from August I ask for further time.
Seems I need to flash the nodemcu (or use another one) however unfortunately I installed it on an nodemcu which is not that accessible
Unfortunately I had not tested the OTA on the August beta version.
It seems to upload the file, then reboot - however it comes back with the old image
Seems I need to flash the nodemcu (or use another one) however unfortunately I installed it on an nodemcu which is not that accessible
Unfortunately I had not tested the OTA on the August beta version.
It seems to upload the file, then reboot - however it comes back with the old image
Re: automation - ansible - sync of rules
A few tricks to help it succeed OTA on unstable WiFi connections:
- Let a ping run from whatever computer to that ESP node during flash
- disable a few tasks, especially ones using SW serial and/or GPIO-0
- Flash the .bin.gz file as it may take less time to transfer
- Set WiFi TX power to max.
- Disable ECO mode
- try flashing from a computer connected to the same WiFi access point, or if that doesn't work, try flashing from a computer actually not connected to WiFi.
- Let a ping run from whatever computer to that ESP node during flash
- disable a few tasks, especially ones using SW serial and/or GPIO-0
- Flash the .bin.gz file as it may take less time to transfer
- Set WiFi TX power to max.
- Disable ECO mode
- try flashing from a computer connected to the same WiFi access point, or if that doesn't work, try flashing from a computer actually not connected to WiFi.
Re: automation - ansible - sync of rules
tested after long time again image: ESP_Easy_mega_20221224_custom_beta_ESP8266_4M1M.bin
However still had problems to load a rules file.
Apache config provided access log, and it is downloadable from normal browser, however in nodemcu the file size is always "0"...
The link you provided long time ago for a special build to test is not completely downloadable for me...
However still had problems to load a rules file.
Apache config provided access log, and it is downloadable from normal browser, however in nodemcu the file size is always "0"...
The link you provided long time ago for a special build to test is not completely downloadable for me...
Re: automation - ansible - sync of rules
Where did you get any Apache access log?
What operating system and browser (versions) are you using? Any security software installed, like antivirus? Brand and versions too, please.
Those download links tend to expire, but if the file is actually there, but you're unable to download, I suspect you have something running on your computer that is interfering with the up- and download of files...
/Ton (PayPal.me)
Re: automation - ansible - sync of rules
Hello,
I am talking about the provisioning feature, so esayesp can download a new rules file via http.
I am talking about the provisioning feature, so esayesp can download a new rules file via http.
on the linux server, the provisioning URL is pointing to.Where did you get any Apache access log?
As mentioned I used the SW version on the nodemcu ESP_Easy_mega_20221224_custom_beta_ESP8266_4M1M.bin and I try to download a rules file from debian apache. Based on following trigger:What operating system and browser (versions) are you using? Any security software installed, like antivirus? Brand and versions too, please.
Code: Select all
on fetch_rules4 do
ProvisionRules,4
endon
agree, however I do not know if it makes sense to invest time is such an old status either...Those download links tend to expire, but if the file is actually there, but you're unable to download, I suspect you have something running on your computer that is interfering with the up- and download of files...
Re: automation - ansible - sync of rules
GREAT!
I tried to download a rules file and it worked, I am exited.
Now I need to play a little bit how to adjust setting with a rules file.
When it is expected that that the custom feature is included to the normal version?
As I am missing notifications with customs version And the colored rules syntax is nice as well...
Thanks!
I tried to download a rules file and it worked, I am exited.
Now I need to play a little bit how to adjust setting with a rules file.
When it is expected that that the custom feature is included to the normal version?
As I am missing notifications with customs version And the colored rules syntax is nice as well...
Thanks!
Re: automation - ansible - sync of rules
Not sure if the provisioning feature will ever be included in a non-custom build.
Problem is that it may allow for an unexpected 'back-door' kind of feature if someone doesn't really know what is enabled and what isn't.
On the other hand, the way we now make builds is no longer practical as you simply can't make good selections of plugins suitable for everyone.
So we really really need to make a build service/server so everyone can make their own custom builds.
Problem is that it may allow for an unexpected 'back-door' kind of feature if someone doesn't really know what is enabled and what isn't.
On the other hand, the way we now make builds is no longer practical as you simply can't make good selections of plugins suitable for everyone.
So we really really need to make a build service/server so everyone can make their own custom builds.
Re: automation - ansible - sync of rules
Valid approach, it there another approach to do automation? Kind of API?
Re: automation - ansible - sync of rules
Well at least the provisioning stuff is now documented
https://espeasy.readthedocs.io/en/lates ... ovisioning
And there are also optional deployment and support wifi credentials:
https://espeasy.readthedocs.io/en/lates ... redentials
https://espeasy.readthedocs.io/en/lates ... ovisioning
And there are also optional deployment and support wifi credentials:
https://espeasy.readthedocs.io/en/lates ... redentials
Re: automation - ansible - sync of rules
Is normal configuration not unencrypted as well?
Re: automation - ansible - sync of rules
What do you mean by "not unencrypted" ?
Re: automation - ansible - sync of rules
I access the UI per http and not per https either
Re: automation - ansible - sync of rules
I have a pending PR (not yet ready) to support TLS for MQTT. (ESP32 only)
Not yet for accessing the web UI via HTTPS.
Not yet for accessing the web UI via HTTPS.
Who is online
Users browsing this forum: Ahrefs [Bot] and 32 guests