mcer12 / Hugo-ESP8266

Hugo is a 4-button ESP8266 Wi-Fi Remote, Arduino compatible and simple to use.
MIT License
110 stars 11 forks source link

Battery reporting topics #6

Closed giddyhup closed 5 years ago

giddyhup commented 5 years ago

Great soft- and hardware! Apparently, a Hugo reports its battery level under two topics, is this on purpose? Also, 0x3e is 62 not 90, what does it stand for?

esp/hugh/battery 3e
esp/hugo/battery 90

I use two Hugos. It would make sense to have the status topics configurable through the web interface.

mcer12 commented 5 years ago

Sorry for getting back to you so late, I didn't receive a notification... this is a bug and will be solved in the upcoming update. I'll comment here once its pushed in the git. Hopefully today.

mcer12 commented 5 years ago

@giddyhup This should also be fixed with the latest sketch.

giddyhup commented 5 years ago

Thanks for the update. The line publishBatteryLevel(); is missing in the code for button 1.

Also, the topic is not unique. I can't tell the battery reporting apart when I have two Hugos. Here's what I did:

void publishBatteryLevel() {
  client.publish(String("hugo" + macLastThreeSegments(mac) + "/battery").c_str(), String(batteryPercentage()).c_str()) ;
  Serial.print("Battery: ");
  Serial.println(batteryPercentage());
}
mcer12 commented 5 years ago

Thanks, you're correct. I pushed your solution. I will add an option for custom topic in the next update.

giddyhup commented 5 years ago

Good idea. In my case I named my two Hugos (red and black) and put the respective names in the topics.

mcer12 commented 5 years ago

@giddyhup Check out the latest update, it's a bigger one.

giddyhup commented 5 years ago

Thanks. I will check it out when I return from my trip in a couple of weeks. Meanwhile, I'll close this issue.