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

Ability to insert chip ID in update URL and MQTT client name #1871

Closed
wants to merge 1 commit into from
Closed

Ability to insert chip ID in update URL and MQTT client name #1871

wants to merge 1 commit into from

Conversation

Leseratte10
Copy link

@Leseratte10 Leseratte10 commented Feb 11, 2018

Tasmota supports the placeholder "%06X" for the MQTT client name which inserts the chip ID in hexadecimal - unfortunately, it does not support other placeholders. I have added "%d" for the chip ID in decimal, and "%04d" for the short chip ID (same as used in the hostname). This is because I identify my sonoff devices using the 4-digit hostname number and also have that in the MQTT client name.

In addition, I added support for placeholders to the OTA update URL. If the update URL contains "%d" (or "%04d"), that will be replaced by the short chip ID (chipID & 0x1fff). If it contains "%u", that will be replaced by the (long) chip ID (both in decimal).

This means, one could now compile one firmware, flash that to multiple Sonoffs, and they'd have different MQTT client names including the ID (in different variants, not just 6-digit hex), and, if the OTA url in the firmware is set correctly (containing a placeholder), the server which you load the update from knows which device requested the update - great for deploying a new testing firmware to just one device.

If the update URL contains "%d" (or "%04d"), that will be replaced by the short chip ID (chipID & 0x1fff). If it contains "%u", that will be replaced by the chip ID.
The MQTT client value now supports "%06X" for the hexadecimal chip ID, "%d" for the decimal chip ID and "%04d" for the short chip ID (chip ID & 0x1fff).
@arendst
Copy link
Owner

arendst commented Feb 12, 2018

Had that a year ago in client id and then people start using strings where integers were expected and they received exceptions everywhere. So I had to revert to a very strict way of doing things.

Looking at your implementation it might work though. Investigating.

arendst added a commit that referenced this pull request Feb 13, 2018
5.12.0b
 * Add serial debug info
 * Add optional usage of %d or %X
suffices in MQTT client to append chipid (#1871)
 * Add optional usage
of %d or %X suffices in MQTT topic to append chipid (#1871)
 * Add
optional usage of %d or %04d in ota url to be replaced with chipid
(#1871)
 * Add user configurable serial GPIOs to MagicHome and Arilux
modules (#1887)
@arendst arendst closed this Feb 13, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this pull request Sep 6, 2018
5.12.0b
 * Add serial debug info
 * Add optional usage of %d or %X
suffices in MQTT client to append chipid (arendst#1871)
 * Add optional usage
of %d or %X suffices in MQTT topic to append chipid (arendst#1871)
 * Add
optional usage of %d or %04d in ota url to be replaced with chipid
(arendst#1871)
 * Add user configurable serial GPIOs to MagicHome and Arilux
modules (arendst#1887)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants