Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethernet IP Config #14385

Closed
wants to merge 4 commits into from
Closed

Conversation

barbudor
Copy link
Contributor

@barbudor barbudor commented Jan 11, 2022

Description:

Following multiple discussions this PR introduces full support for Ethernet IP configuration independently of Wifi

  • New commands dedicated to Ethernet
    • EthIpAddress
    • EthGateway
    • EthSubnetmask (aligned to D_JSON_SUBNETMASK)
    • EthDNSServer[1|2]
    • Configuration saved in dedicated Setting area only for ESP32 (excluding C3/S2)
  • Update Status 5 with separated details for Wifi (legacy) and Ethernet
{
    "StatusNET":{
        "Hostname":"myesp","IPAddress":"192.168.168.51","Gateway":"192.168.168.254","Subnetmask":"255.255.255.0",
        "DNSServer1":"192.168.168.244","DNSServer2":"1.1.1.1","Mac":"F0:08:D1:F7:B9:D0",
        "EthHostname":"myesp-eth","EthIPAddress":"192.168.100.100","EthGateway":"192.168.100.1","EthSubnetmask":"255.255.255.0",
        "EthDNSServer1":"1.1.1.1","EthDNSServer2":"8.8.8.8","EthMac":"12:34:56:78:9A:BC",
        "Webserver":2,"HTTP_API":1,"WifiConfig":5,"WifiPower":17.0
    }
}
  • Update the INFO2 Message
{
    "Info2":{
        "WebServerMode":"Admin","Hostname":"myesp","IPAddress":"192.168.168.51",
        "EthHostname":"myesp-eth","EthIPAddress":"192.168.100.100"
    }
}
  • Add rules events
    • on Eth#Connected do
    • on Eth#Disconnected do

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.2
  • I accept the CLA.

Copy link
Collaborator

@s-hadinger s-hadinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR. Just a remark about possible use of a prefix for all Eth commands

#define D_CMND_ETHIPADDRESS "Eth" D_CMND_IPADDRESS
#define D_CMND_ETHGATEWAY "Eth" D_JSON_GATEWAY
#define D_CMND_ETHNETMASK "Eth" D_JSON_SUBNETMASK
#define D_CMND_ETHDNS "Eth" D_JSON_DNSSERVER

const char kEthernetCommands[] PROGMEM = "|" // No prefix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually use "Eth" as prefix before the first "|"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do in a minute
Is there also an way got extract a sub command to avoid the array below?

uint16_t spare11 : 1;
uint16_t spare12 : 1;
uint16_t eth_connected : 1;
uint16_t eth_disconnected : 1;
uint16_t spare13 : 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue with shutters here. I don't like the shutter solution and I will see if this can be solved first to merge your PR.

In short, ifdef USE_SHUTTERS changes the amount of bits tested based on the assumptions the last two bits are for shutter status. This changes with your implemntation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bits are not persistent so I suggest the following:

  • Insert your entries just above the http_init bit.
  • Increment both MAX_RULES_FLAG by two.
  • Update RulesEvery50ms() by insert your rule text above the HTTP entries. So they become 8 and 9. HTTP becomes 10 and the optional shutter ones become 11 and 12.

@arendst arendst added the on hold by dev team Result - Feature request put on hold by member of development team label Jan 12, 2022
uint8_t free_ea6[32]; // EA6
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point but this results in issues in the future where these bits are used for all processor types. I suggest to move it to the 32-bit register area at the bottom just above F9C and reserve it fixed for all processor types. No ifdefs needed.

@arendst arendst added the awaiting feedback Action - Waiting for response or more information label Jan 12, 2022
@arendst
Copy link
Owner

arendst commented Jan 12, 2022

Latest update as of 20220115-15:15

I will make the changes to this PR and implement it like you did solving some issues on the way.

Pls hold on and do not make any changes to this PR anymore.

@arendst arendst self-assigned this Jan 12, 2022
@arendst arendst removed the awaiting feedback Action - Waiting for response or more information label Jan 12, 2022
arendst added a commit that referenced this pull request Jan 12, 2022
Phase 1 Ethernet IP address config (#14385)
- Currently unable to change DNS servers
arendst added a commit that referenced this pull request Jan 13, 2022
Phase 2 of 2 Ethernet IP address config based on PR (#14385)
arendst added a commit that referenced this pull request Jan 13, 2022
Add commands for ESP32 ethernet configuration ``EthIpAddress``, ``EthGateway``, ``EthSubnetmask``, ``EthDnsServer1`` and ``EthDnsServer2`` (#14385)
@arendst
Copy link
Owner

arendst commented Jan 13, 2022

This has been implemented today.

@arendst arendst closed this Jan 13, 2022
@barbudor barbudor deleted the eth_settings branch January 13, 2022 19:51
@barbudor
Copy link
Contributor Author

Thanks Theo

@labmaster
Copy link

labmaster commented Jan 31, 2022

@barbudor

Description:

Following multiple discussions this PR introduces full support for Ethernet IP configuration independently of Wifi

* New commands dedicated to Ethernet
  
  * `EthIpAddress`
  * `EthGateway`
  * `EthSubnetmask`  (aligned to D_JSON_SUBNETMASK)
  * `EthDNSServer[1|2]`
  * Configuration saved in dedicated Setting area only for ESP32 (excluding C3/S2)

...

i can t get EthDNSServer1 and /or EthDNSServer2 set.

IP, Gateway and Subnetmask can be set, and then correctly shown in the "Main Menu"->"Information" Tab, but not the DNS ServerIP, they always stay at 0.0.0.0 there.

Any hint ?

Thanks, Walter

@barbudor
Copy link
Contributor Author

I'm not sure the PR covered the web GUi
Please open an issue filling all required details

  • screenshots of the problematic screens
    Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold by dev team Result - Feature request put on hold by member of development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants